Commit 7cd8e282 by Eric Fischer

actually check if staff grade is staff grade

parent d6fe11e2
...@@ -82,6 +82,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel): ...@@ -82,6 +82,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
DEFAULT_ASSESSMENT_SCORE_PRIORITY DEFAULT_ASSESSMENT_SCORE_PRIORITY
) )
STAFF_ANNOTATION_TYPE = "staff_defined"
submission_uuid = models.CharField(max_length=36, db_index=True, unique=True) submission_uuid = models.CharField(max_length=36, db_index=True, unique=True)
uuid = UUIDField(version=1, db_index=True, unique=True) uuid = UUIDField(version=1, db_index=True, unique=True)
...@@ -316,8 +318,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel): ...@@ -316,8 +318,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
old_score = sub_api.get_latest_score_for_submission(self.submission_uuid) old_score = sub_api.get_latest_score_for_submission(self.submission_uuid)
if ( if (
not old_score or # There is no recorded score not old_score or # There is no recorded score
not old_score.get('staff_id') or # The recorded score is not a staff score not self.STAFF_ANNOTATION_TYPE in old_score.get('annotation_types') or # Not a staff score
old_score['points_earned'] != new_staff_score['points_earned'] # Previous staff score doesn't match old_score['points_earned'] != new_staff_score['points_earned'] # Previous staff score doesn't match
): ):
# Set the staff score using submissions api, and log that fact # Set the staff score using submissions api, and log that fact
self.set_staff_score(new_staff_score) self.set_staff_score(new_staff_score)
...@@ -426,7 +428,6 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel): ...@@ -426,7 +428,6 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
will be used in the event that this parameter is not provided. will be used in the event that this parameter is not provided.
""" """
annotation_type = "staff_defined"
if reason is None: if reason is None:
reason = "A staff member has defined the score for this submission" reason = "A staff member has defined the score for this submission"
sub_dict = sub_api.get_submission_and_student(self.submission_uuid) sub_dict = sub_api.get_submission_and_student(self.submission_uuid)
...@@ -440,7 +441,7 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel): ...@@ -440,7 +441,7 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
score["points_earned"], score["points_earned"],
score["points_possible"], score["points_possible"],
annotation_creator=score["staff_id"], annotation_creator=score["staff_id"],
annotation_type=annotation_type, annotation_type=self.STAFF_ANNOTATION_TYPE,
annotation_reason=reason annotation_reason=reason
) )
......
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