-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement/wrobe0709/list unenrolled submissions #1128
base: master
Are you sure you want to change the base?
Changes from 3 commits
2ce9e7c
2f2d4be
ba5ea40
0cb91aa
691be4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,7 +450,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, | ||
|
@@ -941,7 +941,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, | ||
|
@@ -1043,6 +1043,24 @@ 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/<int:cid>/unenrolled", methods=['GET']) | ||
@is_staff(course_arg='cid') | ||
def unenrolled(cid): | ||
courses, current_course = get_courses(cid) | ||
|
||
submissions = set(b.submitter_id for b in (Backup.query.join(Backup.assignment).filter(Assignment.course_id == cid).all())) | ||
enrollment = set(e.user_id for e in (Enrollment.query.filter(Enrollment.course_id == cid).all())) | ||
unenrolled_submitters = [] | ||
|
||
for s in submissions: | ||
if s not in enrollment: | ||
unenrolled_submitters.append(User.query.get(s)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above - you should be able to do e.user if you use enrollment objects directly |
||
|
||
return render_template('staff/course/enrollment/enrollment.unenrolled.html', | ||
current_course=current_course, | ||
unenrolled_submitters=unenrolled_submitters, | ||
title="Submitter") | ||
|
||
################ | ||
# Student View # | ||
################ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} | ||
<section class="content-header"> | ||
<h1> | ||
{{ current_course.display_name_with_semester }} Un-Enrolled Submitters | ||
<small>{{ current_course.offering }}</small> | ||
</h1> | ||
<ol class="breadcrumb"> | ||
<li><a href="{{ url_for(".course", cid=current_course.id) }}"> | ||
<i class="fa fa-university"></i> {{ current_course.offering }} | ||
</a></li> | ||
<li class="active"><a href="{{ url_for('.unenrolled', cid=current_course.id) }}"> | ||
<i class="fa fa-user-o"></i> Un-Enrolled Submitters</a> | ||
</li> | ||
</ol> | ||
</section> | ||
<section class="content"> | ||
{% include 'alerts.html' %} | ||
<div class="row"> | ||
<div class="col-md-9 col-xs-12"> | ||
<div class="box"> | ||
<div class="box-header"> | ||
<h3 class="box-title"><span> {{ title }} </span></h3> | ||
<div class="box-tools"> | ||
<div class="box-tools pull-right"> | ||
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"> | ||
<i class="fa fa-minus"></i> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- /.box-header --> | ||
<div class="box-body table-responsive no-padding table-loading" id="{{ title }}-list"> | ||
<table class="table table-hover"> | ||
<thead> | ||
<th class="sort" data-sort="email">User</th> | ||
<th class="sort" data-sort="sid">SID</th> | ||
</thead> | ||
|
||
<tbody class="list"> | ||
{% for unenrolled_submitter in unenrolled_submitters %} | ||
<tr> | ||
<td class="email"> | ||
<a href="{{ url_for('.student_view', cid=current_course.id, email=unenrolled_submitter.email) }}"> | ||
{{ unenrolled_submitter.email }} | ||
</a> | ||
</td> | ||
<td class="sid">{{ unenrolled_submitter.id }}</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ID isn't particularly useful (it's our database ID) Maybe their name could go here instead? |
||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
<!-- /.box-body --> | ||
<div class="box-footer"> | ||
<div class="pull-left"> | ||
<h5 class="box-title"><span> Total: {{ unenrolled_submitters | length }} </span></h5> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are a bit too long. I would suggest putting the queries on their own lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can use course.get_students here? It also does a joined load with Users - so you can just do e.user without the cost of another query