Skip to content

Commit

Permalink
show courses that are not assigned to a teacher in teacher overview
Browse files Browse the repository at this point in the history
  • Loading branch information
urvdp committed Apr 14, 2024
1 parent 37aefd5 commit d96187b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
13 changes: 12 additions & 1 deletion src/spz/administration/admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,18 @@ def administration_teacher_lang(id):
.filter(models.Role.role == 'COURSE_TEACHER') \
.distinct().all()

return dict(language=lang, teacher=teacher)
# courses with assigned teachers
assigned_courses = db.session.query(models.Role.course_id) \
.filter(models.Role.role == models.Role.COURSE_TEACHER) \
.subquery()

unassigned_courses = db.session.query(models.Course) \
.join(models.Language) \
.filter(models.Language.id == id) \
.filter(~models.Course.id.in_(assigned_courses))
#~Course.id.in_(assigned_courses)

return dict(language=lang, teacher=teacher, unassigned_courses=unassigned_courses)


@templated('internal/administration/add_teacher.html')
Expand Down
6 changes: 4 additions & 2 deletions src/spz/templates/baselayout.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
{% endblock head %}

{% block style %}
.auto-height-row {
height: 100px;
.inline-flex-container {
display: inline-flex;
align-items: center; // Vertical alignment
justify-content: center; // Horizontal alignment
}
{% endblock style %}
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


{% block internal_body %}
<!---
<div class="row">
<div class="ui message">
<div class="header">Infos</div>
Expand All @@ -20,6 +21,7 @@
</dl>
</div>
</div>
--->
<div>
<a href="{{ url_for('add_teacher', id=language.id) }}">
<button class="ui basic button">
Expand All @@ -34,8 +36,6 @@
<tr>
<th>Lehrbeauftragte*r</th>
<th>Kurse</th>
<th>Option 1</th>
<th>Option 2</th>
</tr>
</thead>
<tbody>
Expand All @@ -56,16 +56,33 @@
{% endif %}
{% endfor %}
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="ui section divider"></div>
<div class="row">
<div class="row">
<table>
<thead>
<tr>
<th><h3>Kurse ohne Dozent</h3></th>
</tr>
</thead>
<tbody>
<tr>
<th>
{% for unassigned in unassigned_courses %}
<a href="{{ url_for('course', id=unassigned.id) }}">
<div class="ui button"> {{ unassigned.full_name }} </div>
</a>
{% endfor %}
</th>
</tr>
</tbody>
</table>
</div>
</div>

{% endblock internal_body %}

0 comments on commit d96187b

Please sign in to comment.