Commit 1b07b5bf by Chris Dodge

add some quick filters to the review admin pane so that global staff users can…

add some quick filters to the review admin pane so that global staff users can quick see which reviews have been internally reviewed (as well as reviewed by 3rd parties)
parent 6587fc50
...@@ -4,6 +4,7 @@ Django Admin pages ...@@ -4,6 +4,7 @@ Django Admin pages
# pylint: disable=no-self-argument, no-member # pylint: disable=no-self-argument, no-member
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django import forms from django import forms
from edx_proctoring.models import ( from edx_proctoring.models import (
ProctoredExamReviewPolicy, ProctoredExamReviewPolicy,
...@@ -72,13 +73,44 @@ def video_url_for_review(obj): ...@@ -72,13 +73,44 @@ def video_url_for_review(obj):
video_url_for_review.allow_tags = True video_url_for_review.allow_tags = True
class ReviewListFilter(admin.SimpleListFilter):
"""
Quick filter to allow admins to see which reviews have not been reviewed internally
"""
title = _('internally reviewed')
parameter_name = 'reviewed_by'
def lookups(self, request, model_admin):
"""
List of values to allow admin to select
"""
return (
('all_unreviewed', _('All Unreviewed')),
('all_unreviewed_failures', _('All Unreviewed Failures')),
)
def queryset(self, request, queryset):
"""
Return the filtered queryset
"""
if self.value() == 'all_unreviewed':
return queryset.filter(reviewed_by__isnull=True)
elif self.value() == 'all_unreviewed_failures':
return queryset.filter(reviewed_by__isnull=True, review_status='Suspicious')
else:
return queryset
class ProctoredExamSoftwareSecureReviewAdmin(admin.ModelAdmin): class ProctoredExamSoftwareSecureReviewAdmin(admin.ModelAdmin):
""" """
The admin panel for SoftwareSecure Review records The admin panel for SoftwareSecure Review records
""" """
readonly_fields = [video_url_for_review, 'attempt_code', 'exam', 'student', 'reviewed_by', 'modified'] readonly_fields = [video_url_for_review, 'attempt_code', 'exam', 'student', 'reviewed_by', 'modified']
list_filter = ['review_status', 'exam__course_id', 'exam__exam_name', 'reviewed_by'] list_filter = ['review_status', 'exam__course_id', 'exam__exam_name', ReviewListFilter]
list_select_related = True list_select_related = True
search_fields = ['student__username', 'attempt_code'] search_fields = ['student__username', 'attempt_code']
form = ProctoredExamSoftwareSecureReviewForm form = ProctoredExamSoftwareSecureReviewForm
......
...@@ -217,6 +217,9 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider): ...@@ -217,6 +217,9 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
review.video_url = video_review_link review.video_url = video_review_link
review.student = attempt_obj.user review.student = attempt_obj.user
review.exam = attempt_obj.proctored_exam review.exam = attempt_obj.proctored_exam
# set reviewed_by to None because it was reviewed by our 3rd party
# service provider, not a user in our database
review.reviewed_by = None
review.save() review.save()
......
...@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths): ...@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup( setup(
name='edx-proctoring', name='edx-proctoring',
version='0.9.12', version='0.9.13',
description='Proctoring subsystem for Open edX', description='Proctoring subsystem for Open edX',
long_description=open('README.md').read(), long_description=open('README.md').read(),
author='edX', author='edX',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment