Skip to content

Commit

Permalink
add teacher administration view
Browse files Browse the repository at this point in the history
  • Loading branch information
urvdp committed Dec 8, 2023
1 parent 7adce2f commit 30147fe
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/spz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def rlrc_comment():
('/internal/login', views.login, ['GET', 'POST']),
('/internal/logout', views.logout, ['GET', 'POST']),

('/internal/administration/teacher', views.administration_teacher, ['GET', 'POST'])

]

for rule, view_func, methods in routes:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% extends 'internal/internal.html' %}
{% from 'formhelpers.html' import td_sorted %}

{% block caption %}
Dozentenverwaltung
{% endblock caption %}


{% block internal_body %}
<div class="row">
<table class="ui selectable sortable compact small striped table">
<thead>
<tr>
<th>Sprache</th>
<th>Kursanzahl</th>
<th>Dozentenanzahl</th>
<th>Dozentenrate pro Kurs</th>
</tr>
</thead>
<tbody>
{% for l in language %}
<tr>
<td><a href="{{ url_for('language', id=l.id) }}"><strong>{{ l.name }}</strong></a>
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock internal_body %}
1 change: 1 addition & 0 deletions src/spz/templates/internal/internal.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<a class="item" href="{{ url_for('outstanding') }}"><i class="warning sign icon"></i> Offene Beträge</a>
<a class="item" href="{{ url_for('statistics') }}"><i class="pie chart icon"></i> Statistiken</a>
<a class="item" href="{{ url_for('duplicates') }}"><i class="random icon"></i> Doppelgänger</a>
<a class="item" href="{{ url_for('administration_teacher') }}"><i class="users icon"></i> Dozentenverwaltung</a>
{% if current_user.superuser %}
<a class="item" href="{{ url_for('preterm') }}"><i class="star icon"></i> Prioritär&shy;anmeldungen</a>
{% endif %}
Expand Down
21 changes: 15 additions & 6 deletions src/spz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,13 +1197,22 @@ def login():
return dict(form=form)


@templated('internal/administration/teacher_overview_base.html')
def administration_teacher():
# list of tuple (lang, aggregated number of courses, aggregated number of seats)
'''lang_misc = db.session.query(models.Language, func.count(models.Language.courses), func.sum(models.Course.limit)) \
.join(models.Course, models.Language.courses) \
.group_by(models.Language) \
.order_by(models.Language.name) \
.from_self() '''

languages = db.session.query(models.Language)


return dict(language=languages)


def logout():
logout_user()
flash(_('Tschau!'), 'success')
return redirect(url_for('login'))


'''def oidc_get_url():
return redirect(url)
'''

0 comments on commit 30147fe

Please sign in to comment.