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):
item_id=student_item_dict["item_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.
submission = Submission.objects.filter(student_item__in=student_items).order_by(
submissions = Submission.objects.filter(student_item__in=student_items).order_by(
"submitted_at",
"-attempt_number")[:1]
"-attempt_number"
)
submission = _get_first_submission_not_evaluated(submissions, student_evaluations)
if not submission:
raise PeerEvaluationWorkflowError(
"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 @@
<th>Submission UUID</th>
<th>Points Earned</th>
<th>Points Possible</th>
<th>Scored By</th>
<th>Scored At</th>
<th>Score Type</th>
<th>Feedback</th>
......@@ -15,6 +16,7 @@
<td>{{ evaluation.points_earned }}</td>
<td>{{ evaluation.points_possible }}</td>
<td>{{ evaluation.scorer_id }}</td>
<td>{{ evaluation.scored_at }}</td>
<td>{{ evaluation.score_type }}</td>
<td>{{ evaluation.feedback }}</td>
</tr>
......
......@@ -109,13 +109,17 @@ class OpenAssessmentBlock(XBlock):
# 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.
student_item_dict = self._get_student_item_dict()
assessment_dict = {"points_earned": data["points_earned"],
"points_possible": 12,
"feedback": "",
assessment_dict = {
"points_earned": map(int, data["points_earned"]),
"points_possible": 12,
"feedback": "Not yet implemented.",
}
evaluation = peer_api.create_evaluation(data["submission_uuid"], student_item_dict["student_id"], assessment_dict)
print "DEBUG: {}".format(evaluation)
return (evaluation, "Assessment handler is not implemented yet.")
evaluation = peer_api.create_evaluation(
data["submission_uuid"],
student_item_dict["student_id"],
assessment_dict
)
return evaluation, "Success"
@XBlock.json_handler
def submit(self, data, suffix=''):
......
......@@ -10,8 +10,8 @@ function OpenAssessmentBlock(runtime, element) {
function prepare_assessment_post(element) {
selector = $("input[type=radio]:checked", element);
values = [];
for (i=0; selector.length; i++) {
values.concat(selector[0].value);
for (i=0; i<selector.length; i++) {
values[i] = selector[i].value;
}
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