Commit 20f23e1e by Stephen Sanchez

Updated the API so it now returns the proper points earned, and updates rows.

parent 9766cf2c
...@@ -279,12 +279,27 @@ def get_submission_to_evaluate(student_item_dict): ...@@ -279,12 +279,27 @@ def get_submission_to_evaluate(student_item_dict):
item_id=student_item_dict["item_id"], item_id=student_item_dict["item_id"],
).exclude(student_id=student_item_dict["student_id"]) ).exclude(student_id=student_item_dict["student_id"])
student_evaluations = PeerEvaluation.objects.filter(
scorer_id=student_item_dict["student_id"]
)
# TODO: We need a priority queue. # TODO: We need a priority queue.
submission = Submission.objects.filter(student_item__in=student_items).order_by( submissions = Submission.objects.filter(student_item__in=student_items).order_by(
"submitted_at", "submitted_at",
"-attempt_number")[:1] "-attempt_number"
)
submission = _get_first_submission_not_evaluated(submissions, student_evaluations)
if not submission: if not submission:
raise PeerEvaluationWorkflowError( raise PeerEvaluationWorkflowError(
"There are no submissions available for evaluation." "There are no submissions available for evaluation."
) )
return SubmissionSerializer(submission[0]).data return SubmissionSerializer(submission).data
def _get_first_submission_not_evaluated(submissions, student_evaluations):
for submission in submissions:
already_evaluated = False
for evaluation in student_evaluations:
already_evaluated = already_evaluated or submission == evaluation.submission
if not already_evaluated:
return submission
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<th>Submission UUID</th> <th>Submission UUID</th>
<th>Points Earned</th> <th>Points Earned</th>
<th>Points Possible</th> <th>Points Possible</th>
<th>Scored By</th>
<th>Scored At</th> <th>Scored At</th>
<th>Score Type</th> <th>Score Type</th>
<th>Feedback</th> <th>Feedback</th>
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
<td>{{ evaluation.points_earned }}</td> <td>{{ evaluation.points_earned }}</td>
<td>{{ evaluation.points_possible }}</td> <td>{{ evaluation.points_possible }}</td>
<td>{{ evaluation.scorer_id }}</td> <td>{{ evaluation.scorer_id }}</td>
<td>{{ evaluation.scored_at }}</td>
<td>{{ evaluation.score_type }}</td> <td>{{ evaluation.score_type }}</td>
<td>{{ evaluation.feedback }}</td> <td>{{ evaluation.feedback }}</td>
</tr> </tr>
......
...@@ -109,13 +109,17 @@ class OpenAssessmentBlock(XBlock): ...@@ -109,13 +109,17 @@ class OpenAssessmentBlock(XBlock):
# TODO: We're not doing points possible, right way to do points possible # TODO: We're not doing points possible, right way to do points possible
# is to refactor the rubric criteria type, Joe has thoughts on this. # is to refactor the rubric criteria type, Joe has thoughts on this.
student_item_dict = self._get_student_item_dict() student_item_dict = self._get_student_item_dict()
assessment_dict = {"points_earned": data["points_earned"], assessment_dict = {
"points_earned": map(int, data["points_earned"]),
"points_possible": 12, "points_possible": 12,
"feedback": "", "feedback": "Not yet implemented.",
} }
evaluation = peer_api.create_evaluation(data["submission_uuid"], student_item_dict["student_id"], assessment_dict) evaluation = peer_api.create_evaluation(
print "DEBUG: {}".format(evaluation) data["submission_uuid"],
return (evaluation, "Assessment handler is not implemented yet.") student_item_dict["student_id"],
assessment_dict
)
return evaluation, "Success"
@XBlock.json_handler @XBlock.json_handler
def submit(self, data, suffix=''): def submit(self, data, suffix=''):
......
...@@ -10,8 +10,8 @@ function OpenAssessmentBlock(runtime, element) { ...@@ -10,8 +10,8 @@ function OpenAssessmentBlock(runtime, element) {
function prepare_assessment_post(element) { function prepare_assessment_post(element) {
selector = $("input[type=radio]:checked", element); selector = $("input[type=radio]:checked", element);
values = []; values = [];
for (i=0; selector.length; i++) { for (i=0; i<selector.length; i++) {
values.concat(selector[0].value); values[i] = selector[i].value;
} }
return {"submission_uuid":$("div#peer_submission_uuid")[0].innerText, "points_earned":values}; return {"submission_uuid":$("div#peer_submission_uuid")[0].innerText, "points_earned":values};
} }
......
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