diff --git a/templates/admin/admin-classes.html b/templates/admin/admin-classes.html index de5c7f340b4..1f22e4c1f80 100644 --- a/templates/admin/admin-classes.html +++ b/templates/admin/admin-classes.html @@ -5,13 +5,15 @@

Classes overview

-

Total amount of shown classes: {{ classes|length }}

+

Total amount of shown classes: {{ classes|length }}
+ Total amount of active classes this week: {{ active_classes|length }}
+ @@ -22,11 +24,13 @@

Total amount of shown classes: {{ classes|length }}

+ {% for class in classes %} + diff --git a/website/admin.py b/website/admin.py index f150a1615a9..2261e9bd5f0 100644 --- a/website/admin.py +++ b/website/admin.py @@ -131,7 +131,9 @@ def get_admin_classes_page(self, user): classes = [ { "name": Class.get("name"), + # replace email by username for easier communication "teacher": Class.get("teacher"), + "email": self.db.user_by_username(Class.get("teacher")).get("email"), "created": utils.localized_date_format(Class.get("date")), "students": len(Class.get("students")) if "students" in Class else 0, "stats": statistics.get_general_class_stats(Class.get("students", [])), @@ -140,9 +142,14 @@ def get_admin_classes_page(self, user): for Class in self.db.all_classes() ] + active_classes = [x for x in classes if x.get("stats").get("week").get("runs") > 0] + classes = sorted(classes, key=lambda d: d.get("stats").get("week").get("runs"), reverse=True) - return render_template("admin/admin-classes.html", classes=classes, page_title=gettext("title_admin")) + return render_template("admin/admin-classes.html", + active_classes=active_classes, + classes=classes, + page_title=gettext("title_admin")) @route("/adventures", methods=["GET"]) @requires_admin
Class name TeacherEmail Created Students Runs this week Class overview
{{class.name}} {{class.teacher}} {{class.created}} {{class.students}} {{class.stats.week.runs}}