File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -725,22 +725,20 @@ def quiz_report_view(request, assignment_id):
725725 content = request .GET .get ("content" , "" )
726726 severity = int (request .GET .get ("severity" , 0 ))
727727
728- if assignment . quiz . ended_for_student ( request . user ):
729- json_data = json . dumps ( "no action" )
730- else :
728+ action = "no action"
729+
730+ if not assignment . quiz . ended_for_student ( request . user ) :
731731 LogMessage .objects .create (
732732 quiz = assignment .quiz , student = request .user , content = content , severity = severity
733733 )
734734
735- resp = "no action"
736735 if severity >= settings .QUIZ_ISSUE_THRESHOLD :
737736 if assignment .quiz .action == "1" :
738- resp = "color"
737+ action = "color"
739738 elif assignment .quiz .action == "2" :
740- resp = "lock"
739+ action = "lock"
741740
742- json_data = json .dumps (resp )
743- return http .JsonResponse (json_data )
741+ return http .JsonResponse ({"action" : action })
744742
745743
746744@login_required
Original file line number Diff line number Diff line change 7979 "severity" : severity ,
8080 } ,
8181 success : function ( data ) {
82- console . log ( data ) ;
83- if ( data == "color" ) {
82+ const action = data . action ;
83+ console . log ( action ) ;
84+ if ( action === "color" ) {
8485 document . body . style . backgroundColor = "#F72F35" ;
8586 }
86- if ( data == "lock" ) {
87+ if ( action = == "lock" ) {
8788 document . location = "{% url 'assignments:show' assignment.id %}" ;
8889 }
8990 } ,
You can’t perform that action at this time.
0 commit comments