Commit f11ab928 by Will Daly

Merge pull request #467 from edx/will/assessment-criterion-migration

Add criterion foreign key to assessment part model (write only)
parents b5669ac8 7585205f
......@@ -500,6 +500,7 @@ class AssessmentPart(models.Model):
MAX_FEEDBACK_SIZE = 1024 * 100
assessment = models.ForeignKey(Assessment, related_name='parts')
criterion = models.ForeignKey(Criterion, null=True, related_name="+")
option = models.ForeignKey(CriterionOption, related_name="+")
# Free-form text feedback for the specific criterion
......@@ -537,9 +538,11 @@ class AssessmentPart(models.Model):
None
"""
options = CriterionOption.objects.select_related().filter(pk__in=option_ids)
cls.objects.bulk_create([
cls(assessment=assessment, option_id=option_id)
for option_id in option_ids
cls(assessment=assessment, option_id=option.pk, criterion_id=option.criterion.pk)
for option in options
])
if criterion_feedback is not None:
......
......@@ -150,7 +150,7 @@ class TestPeerApi(CacheResetTest):
Tests for the peer assessment API functions.
"""
CREATE_ASSESSMENT_NUM_QUERIES = 60
CREATE_ASSESSMENT_NUM_QUERIES = 61
def test_create_assessment_points(self):
self._create_student_and_submission("Tim", "Tim's answer")
......
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