diff --git a/server/controllers/admin.py b/server/controllers/admin.py index 8f52e0192..4a0723dc9 100644 --- a/server/controllers/admin.py +++ b/server/controllers/admin.py @@ -465,7 +465,7 @@ def assignment_stats(cid, aid): return abort(401) stats = Assignment.assignment_stats(assign.id) - + submissions = [d for d in stats.pop('raw_data')] pie_chart = pygal.Pie(half_pie=True, disable_xml_declaration=True, @@ -1203,7 +1203,7 @@ def enrollment(cid): students = current_course.get_students() staff = current_course.get_staff() lab_assistants = current_course.get_participants([LAB_ASSISTANT_ROLE]) - + return render_template('staff/course/enrollment/enrollment.html', enrollments=students, staff=staff, lab_assistants=lab_assistants, @@ -1312,6 +1312,28 @@ def client(client_id): return redirect(url_for(".clients")) return render_template('staff/edit_client.html', client=client, form=form, courses=courses) +@admin.route("/course//unenrolled", methods=['GET']) +@is_staff(course_arg='cid') +def unenrolled(cid): + courses, current_course = get_courses(cid) + + unenrolled_submitters = [] + staff = set(s.user for s in current_course.get_staff()) + lab_assistants = set(l.user for l in current_course.get_participants([LAB_ASSISTANT_ROLE])) + students = set(e.user for e in current_course.get_students()) + + submissions = Backup.query.join(Backup.assignment).filter(Assignment.course_id == cid).all() + submissions = set(User.query.get(b.submitter_id) for b in submissions) + + for s in submissions: + if s not in students and s not in staff and s not in lab_assistants: + unenrolled_submitters.append(s) + + return render_template('staff/course/enrollment/enrollment.unenrolled.html', + current_course=current_course, + unenrolled_submitters=unenrolled_submitters, + title="Submitter") + ################ # Student View # ################ diff --git a/server/models.py b/server/models.py index a54bd9f88..33f85cd07 100644 --- a/server/models.py +++ b/server/models.py @@ -436,7 +436,7 @@ def assignment_stats(assign_id, detailed=True): 'active_groups': active_groups, 'percent_groups_active': active_groups/(stats['groups'] or 1) }) - + if detailed: stats.update({ 'raw_data': data @@ -590,10 +590,10 @@ def course_submissions(self, include_empty=True): current_db = db.engine.name if current_db != 'mysql': return self.course_submissions_slow(include_empty=include_empty) - + # Can only run the fast query on MySQL submissions = [] - + stats = self.mysql_course_submissions_query() keys = stats.keys() for r in stats: diff --git a/server/templates/staff/course/course.html b/server/templates/staff/course/course.html index f60bf24e2..c8bdbe658 100644 --- a/server/templates/staff/course/course.html +++ b/server/templates/staff/course/course.html @@ -91,6 +91,12 @@

Quick Links

Enrollment +
  • + + + Un-Enrolled Submitters + +
  • diff --git a/server/templates/staff/course/enrollment/enrollment.unenrolled.html b/server/templates/staff/course/enrollment/enrollment.unenrolled.html new file mode 100644 index 000000000..bbf2278b6 --- /dev/null +++ b/server/templates/staff/course/enrollment/enrollment.unenrolled.html @@ -0,0 +1,71 @@ +{% extends "staff/base.html" %} +{% import 'staff/_formhelpers.html' as forms %} + +{% block title %} Un-Enrolled Submitters - {{ current_course.display_name_with_semester }}{% endblock %} + +{% block main %} +
    +

    + {{ current_course.display_name_with_semester }} Un-Enrolled Submitters + {{ current_course.offering }} +

    +
    +
    +
    + {% include 'alerts.html' %} +
    +
    +
    +
    +

    {{ title }}

    +
    +
    + +
    +
    +
    + + +
    + + + + + + + + {% for unenrolled_submitter in unenrolled_submitters %} + + + + + {% endfor %} + +
    UserName
    {{ unenrolled_submitter.name }}
    +
    + + + +
    +
    +
    + +
    +{% endblock %} diff --git a/tests/test_web.py b/tests/test_web.py index a4222b6dd..2d74850ea 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -387,6 +387,12 @@ def test_admin_enrollment(self): self.assertTrue(self.course.offering in self.driver.page_source) self.assertTrue('Export Roster' in self.driver.page_source) + def test_admin_enrollment_unenrolled(self): + self._login(role="admin") + self.page_load(self.get_server_url() + "/admin/course/1/unenrolled") + self.assertIn('Un-Enrolled', self.driver.title) + self.assertTrue(self.course.offering in self.driver.page_source) + def test_admin_student_overview(self): self._login(role="admin") self.page_load(self.get_server_url() + "/admin/course/1/{}".format(self.user1.email))