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