Skip to content

Commit

Permalink
Issue 1097 - Add a view with a list of students for a course (#1157)
Browse files Browse the repository at this point in the history
Resolve issue #1097
Add a view of all students enrolled and in queue for a course and each type of groups. The view is available with a "Lista" button on the course page in next to the course name, and each group section.

The view is quite similar to the one for a group. It contains a list of enrolled and queued students, a number of enrolled and queued students, the ability to send an email (hidden addresses or not) and to download a csv list.

We define that a student is enrolled in a course, if he is enrolled in any group in the course. A student is in a queue for a course, if he is in a queue for any group and is not enrolled in any group.
  • Loading branch information
moalje committed Feb 14, 2022
1 parent f5b96f8 commit bdcabb1
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ <h1 class="d-inline-block">
{{ course.name }}
<small class="text-muted">{{ course.semester.get_short_name }}</small>
</h1>
{% if user.is_staff or course.owner == request.user.employee %}
{% if course.semester.is_current_semester %}
<a class="btn btn-sm btn-outline-info float-right align-bottom" href="{% url 'proposal-edit' course.offer.slug %}">Edytuj</a>
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-sm btn-outline-info float-right align-bottom" href="{% url 'course-student-list' course.slug %}">Lista</a>
{% if user.is_staff or course.owner == request.user.employee %}
{% if course.semester.is_current_semester %}
<a class="btn btn-sm btn-outline-info float-right align-bottom" href="{% url 'proposal-edit' course.offer.slug %}">Edytuj</a>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>

<table class="table table-bordered table-md-responsive" id="table-info">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{% extends "courses/base.html" %}

{% load course_types %}

{% block main-subtitle %}
{{ course }}
{% endblock %}

{% block enrollment_menu_courses %} class="active"{% endblock %}

{% block bread %}
<li class="breadcrumb-item">
<a href="{% url 'main-page' %}">Strona główna</a>
</li>

<li class="breadcrumb-item">
<a href="{% url 'course-list' %}">Zapisy</a>
</li>

<li class="breadcrumb-item">
<a href="{% url 'course-list' %}">Przedmioty</a>
</li>

<li class="breadcrumb-item">
<a href="{% url 'course-page' course.slug %}">
{{course.name}}
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
lista
</li>
{% endblock %}



{% block content %}
<header class="d-flex justify-content-between align-items-center">
<div>
<h1>{{ course }}</h1>
{% if class_type %}
<h3 class="d-inline-block">{{ class_type|decode_class_type_plural }}</h3>
{% endif %}
</div>
</header>


<hr>

<div class="table-responsive-sm">
<h3>Lista osób zapisanych na przedmiot:</h3>
<p>
Liczba zapisanych osób: {{students_in_course|length}}
</p>

{% if students_in_course %}
{% include "courses/students_list.html" with students=students_in_course %}

{% if request.user.is_staff or request.user.employee %}
<div class="d-print-none">
<h5>Wyślij wiadomość do grupy</h5>
<ul>
<li><a href="mailto:{{ mailto_group }}">udostępniając adresy mailowe studentów</a></li>
<li><a href="mailto:{{ mailto_group_bcc }}">ukrywając adresy mailowe studentów</a></li>
</ul>

<h5>Ściągnij listę studentów z grupy jako:</h5>
<ul>
<li><a href="{% url 'course-csv' course.slug %}">csv</a></li>
</ul>
</div>
{% endif %}
{% endif %}
</div>

<div class="table-responsive-sm d-print-none">
{%if students_in_queue %}
<h3>Lista osób oczekujących na zapis:</h3>
<p>Liczba osób oczekujących na zapis: {{students_in_queue|length}}</p>

{% include "courses/students_list.html" with students=students_in_queue %}

{% if request.user.is_staff or request.user.employee %}
<h5>Wyślij wiadomość do kolejki</h5>
<ul>
<li><a href="mailto:{{ mailto_queue }}">udostępniając adresy mailowe studentów</a></li>
<li><a href="mailto:{{ mailto_queue_bcc }}">ukrywając adresy mailowe studentów</a></li>
</ul>

<h5>Ściągnij listę studentów z kolejki jako:</h5>
<ul>
<li><a href="{% url 'course-queue-csv' course.slug %}">csv</a></li>
</ul>
{% endif %}
{% endif %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
{% load filters %}

<div class="table-responsive tutorial">
<h3 class="d-inline-block">{{ class_type|decode_class_type_plural }}
<h3 class="d-inline-block">{{ class_type|decode_class_type_plural }}
</h3>
<a class="btn btn-sm btn-outline-info float-right align-bottom" href="{% url 'class-type-student-list' course.slug class_type %}">Lista</a>
{% if class_type in waiting_students %}
<span class="badge badge-danger d-inline-block align-text-bottom ml-2">
Niezapisanych&mdash;oczekujących
Expand Down
4 changes: 4 additions & 0 deletions zapisy/apps/enrollment/courses/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
urlpatterns = [
path('', views.courses_list, name='course-list'),
path('<slug:slug>', views.course_view, name='course-page'),
path('<slug:course_slug>/list', views.course_list_view, name='course-student-list'),
path('<slug:course_slug>/<int:class_type>/list', views.course_list_view, name='class-type-student-list'),
path('semester/<int:semester_id>', views.courses_list, name='courses-semester'),
path('group/<int:group_id>', views.group_view, name='group-view'),
path('group/<int:group_id>/group/csv', views.group_enrolled_csv, name='group-csv'),
path('group/<int:group_id>/queue/csv', views.group_queue_csv, name='queue-csv'),
path('course/<slug:course_slug>/course/csv', views.course_enrolled_csv, name='course-csv'),
path('course/<slug:course_slug>/queue/csv', views.course_queue_csv, name='course-queue-csv'),

]
Loading

0 comments on commit bdcabb1

Please sign in to comment.