Commit c4750456 by Stephen Sanchez

Fix the checks in the migration script, and fix a mistaken tweak in the new graded_count field

parent cdf68aca
......@@ -15,9 +15,9 @@ class Migration(SchemaMigration):
if not db.dry_run:
for workflow in orm.PeerWorkflow.objects.all():
graded_by = workflow.graded_by.all().order_by('id')
graded_by = workflow.graded_by.filter(assessment__isnull=False).order_by('assessment')
if graded_by:
workflow.graded_count = workflow.graded_by.filter(assessment__null=False).count()
workflow.graded_count = workflow.graded_by.filter(assessment__isnull=False).count()
workflow.save()
def backwards(self, orm):
......
......@@ -910,7 +910,8 @@ def _close_active_assessment(workflow, submission_uuid, assessment):
try:
item = workflow.graded.get(submission_uuid=submission_uuid)
item.assessment = assessment
item.scorer.graded_count += 1
item.author.graded_count += 1
item.author.save()
item.save()
except (DatabaseError, PeerWorkflowItem.DoesNotExist):
error_message = _(
......
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