Commit 01540db4 by Eric Fischer Committed by GitHub

Merge pull request #951 from edx/efischer/dont_push_master

Actually check if staff grade is staff grade
parents 9701adb4 553c924e
......@@ -82,6 +82,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
DEFAULT_ASSESSMENT_SCORE_PRIORITY
)
STAFF_ANNOTATION_TYPE = "staff_defined"
submission_uuid = models.CharField(max_length=36, db_index=True, unique=True)
uuid = UUIDField(version=1, db_index=True, unique=True)
......@@ -315,9 +317,12 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
# new_staff_score is just the most recent staff score, it may already be recorded in sub_api
old_score = sub_api.get_latest_score_for_submission(self.submission_uuid)
if (
not old_score or # There is no recorded score
not old_score.get('staff_id') or # The recorded score is not a staff score
old_score['points_earned'] != new_staff_score['points_earned'] # Previous staff score doesn't match
# Does a prior score exist? Is it a staff score? Do the points earned match?
not old_score or
not self.STAFF_ANNOTATION_TYPE in [
annotation['annotation_type'] for annotation in old_score['annotations']
] or
old_score['points_earned'] != new_staff_score['points_earned']
):
# Set the staff score using submissions api, and log that fact
self.set_staff_score(new_staff_score)
......@@ -426,7 +431,6 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
will be used in the event that this parameter is not provided.
"""
annotation_type = "staff_defined"
if reason is None:
reason = "A staff member has defined the score for this submission"
sub_dict = sub_api.get_submission_and_student(self.submission_uuid)
......@@ -440,7 +444,7 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
score["points_earned"],
score["points_possible"],
annotation_creator=score["staff_id"],
annotation_type=annotation_type,
annotation_type=self.STAFF_ANNOTATION_TYPE,
annotation_reason=reason
)
......
......@@ -6,7 +6,7 @@
git+https://github.com/edx/XBlock.git@xblock-0.4.12#egg=XBlock==0.4.12
# edx-submissions
git+https://github.com/edx/edx-submissions.git@1.1.2#egg=edx-submissions==1.1.2
git+https://github.com/edx/edx-submissions.git@1.1.4#egg=edx-submissions==1.1.4
# Third Party Requirements
boto>=2.32.1,<3.0.0
......
#!/usr/bin/env bash
MAX_PYLINT_VIOLATIONS=504
MAX_PYLINT_VIOLATIONS=472
mkdir -p test/logs
PYLINT_VIOLATIONS=test/logs/pylint.txt
......
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