Commit 3e23b9e1 by Diana Huang

Merge pull request #1480 from MITx/diana/staff-grading-flagging

Flag submissions from staff grading view
parents dceb8fee 285e5758
...@@ -53,7 +53,7 @@ class MockStaffGradingService(object): ...@@ -53,7 +53,7 @@ class MockStaffGradingService(object):
]}) ]})
def save_grade(self, course_id, grader_id, submission_id, score, feedback, skipped, rubric_scores): def save_grade(self, course_id, grader_id, submission_id, score, feedback, skipped, rubric_scores, submission_flagged):
return self.get_next(course_id, 'fake location', grader_id) return self.get_next(course_id, 'fake location', grader_id)
...@@ -114,7 +114,7 @@ class StaffGradingService(GradingService): ...@@ -114,7 +114,7 @@ class StaffGradingService(GradingService):
return json.dumps(self._render_rubric(response)) return json.dumps(self._render_rubric(response))
def save_grade(self, course_id, grader_id, submission_id, score, feedback, skipped, rubric_scores): def save_grade(self, course_id, grader_id, submission_id, score, feedback, skipped, rubric_scores, submission_flagged):
""" """
Save a score and feedback for a submission. Save a score and feedback for a submission.
...@@ -133,7 +133,8 @@ class StaffGradingService(GradingService): ...@@ -133,7 +133,8 @@ class StaffGradingService(GradingService):
'grader_id': grader_id, 'grader_id': grader_id,
'skipped': skipped, 'skipped': skipped,
'rubric_scores': rubric_scores, 'rubric_scores': rubric_scores,
'rubric_scores_complete': True} 'rubric_scores_complete': True,
'submission_flagged': submission_flagged}
return self.post(self.save_grade_url, data=data) return self.post(self.save_grade_url, data=data)
...@@ -292,7 +293,7 @@ def save_grade(request, course_id): ...@@ -292,7 +293,7 @@ def save_grade(request, course_id):
if request.method != 'POST': if request.method != 'POST':
raise Http404 raise Http404
required = set(['score', 'feedback', 'submission_id', 'location', 'rubric_scores[]']) required = set(['score', 'feedback', 'submission_id', 'location','submission_flagged', 'rubric_scores[]'])
actual = set(request.POST.keys()) actual = set(request.POST.keys())
missing = required - actual missing = required - actual
if len(missing) > 0: if len(missing) > 0:
...@@ -313,7 +314,8 @@ def save_grade(request, course_id): ...@@ -313,7 +314,8 @@ def save_grade(request, course_id):
p['score'], p['score'],
p['feedback'], p['feedback'],
skipped, skipped,
p.getlist('rubric_scores[]')) p.getlist('rubric_scores[]'),
p['submission_flagged'])
except GradingServiceError: except GradingServiceError:
log.exception("Error saving grade") log.exception("Error saving grade")
return _err_response('Could not connect to grading service') return _err_response('Could not connect to grading service')
......
...@@ -100,6 +100,7 @@ class TestStaffGradingService(ct.PageLoader): ...@@ -100,6 +100,7 @@ class TestStaffGradingService(ct.PageLoader):
'feedback': 'great!', 'feedback': 'great!',
'submission_id': '123', 'submission_id': '123',
'location': self.location, 'location': self.location,
'submission_flagged': "true",
'rubric_scores[]': ['1', '2']} 'rubric_scores[]': ['1', '2']}
r = self.check_for_post_code(200, url, data) r = self.check_for_post_code(200, url, data)
......
...@@ -170,6 +170,7 @@ class @StaffGrading ...@@ -170,6 +170,7 @@ class @StaffGrading
@feedback_area = $('.feedback-area') @feedback_area = $('.feedback-area')
@score_selection_container = $('.score-selection-container') @score_selection_container = $('.score-selection-container')
@grade_selection_container = $('.grade-selection-container') @grade_selection_container = $('.grade-selection-container')
@flag_submission_checkbox = $('.flag-checkbox')
@submit_button = $('.submit-button') @submit_button = $('.submit-button')
@action_button = $('.action-button') @action_button = $('.action-button')
...@@ -255,6 +256,7 @@ class @StaffGrading ...@@ -255,6 +256,7 @@ class @StaffGrading
submission_id: @submission_id submission_id: @submission_id
location: @location location: @location
skipped: true skipped: true
submission_flagged: false
@backend.post('save_grade', data, @ajax_callback) @backend.post('save_grade', data, @ajax_callback)
get_problem_list: () -> get_problem_list: () ->
...@@ -268,6 +270,7 @@ class @StaffGrading ...@@ -268,6 +270,7 @@ class @StaffGrading
feedback: @feedback_area.val() feedback: @feedback_area.val()
submission_id: @submission_id submission_id: @submission_id
location: @location location: @location
submission_flagged: @flag_submission_checkbox.is(':checked')
@backend.post('save_grade', data, @ajax_callback) @backend.post('save_grade', data, @ajax_callback)
...@@ -325,6 +328,7 @@ class @StaffGrading ...@@ -325,6 +328,7 @@ class @StaffGrading
@error_container.html(@error_msg) @error_container.html(@error_msg)
@message_container.toggle(@message != "") @message_container.toggle(@message != "")
@error_container.toggle(@error_msg != "") @error_container.toggle(@error_msg != "")
@flag_submission_checkbox.prop('checked', false)
# only show the grading elements when we are not in list view or the state # only show the grading elements when we are not in list view or the state
......
...@@ -78,7 +78,9 @@ ...@@ -78,7 +78,9 @@
<h3>Written Feedback</h3> <h3>Written Feedback</h3>
<textarea name="feedback" placeholder="Feedback for student (optional)" <textarea name="feedback" placeholder="Feedback for student (optional)"
class="feedback-area" cols="70" ></textarea> class="feedback-area" cols="70" ></textarea>
</div> <p>
Flag as inappropriate content for later review <input class="flag-checkbox" type="checkbox" />
</p>
<div class="submission"> <div class="submission">
......
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