Commit 9656880c by Stephen Sanchez

Code Review tweaks

parent 883f6ba3
...@@ -260,9 +260,9 @@ def get_assessment_median_scores(submission_id, must_be_graded_by): ...@@ -260,9 +260,9 @@ def get_assessment_median_scores(submission_id, must_be_graded_by):
# Once we have lists of values for each criterion, sort each value and set # Once we have lists of values for each criterion, sort each value and set
# to the median value for each. # to the median value for each.
for criterion in scores.keys(): for criterion, criterion_scores in scores.iteritems():
total_criterion_scores = len(scores[criterion]) total_criterion_scores = len(scores[criterion])
criterion_scores = sorted(scores[criterion]) criterion_scores = sorted(criterion_scores)
median = int(math.ceil(total_criterion_scores / float(2))) median = int(math.ceil(total_criterion_scores / float(2)))
if total_criterion_scores == 0: if total_criterion_scores == 0:
criterion_score = 0 criterion_score = 0
......
...@@ -4,7 +4,6 @@ Serializers are created to ensure models do not have to be accessed outside the ...@@ -4,7 +4,6 @@ Serializers are created to ensure models do not have to be accessed outside the
scope of the Tim APIs. scope of the Tim APIs.
""" """
from copy import deepcopy from copy import deepcopy
import math
from rest_framework import serializers from rest_framework import serializers
from openassessment.peer.models import ( from openassessment.peer.models import (
...@@ -139,6 +138,14 @@ def get_assessment_review(submission): ...@@ -139,6 +138,14 @@ def get_assessment_review(submission):
the assessment, all assessment parts, all criterion options, and the the assessment, all assessment parts, all criterion options, and the
associated rubric. associated rubric.
Args:
submission (Submission): The Submission Model object to get
assessment reviews for.
Returns:
(list): A list of assessment reviews, combining assessments with
rubrics and assessment parts, to allow a cohesive object for
rendering the complete peer grading workflow.
""" """
reviews = [] reviews = []
assessments = Assessment.objects.filter(submission=submission) assessments = Assessment.objects.filter(submission=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