Commit 7440723a by Eric Fischer

Delete Student State ORA fix (Proof-of-concept)

Not at all the final version of this, but I have tested this locally,
and it deletes what we need to delete and seems to solve all the problems
described in TNL-3880.
parent 02ccd59d
......@@ -643,6 +643,37 @@ def get_latest_score_for_submission(submission_uuid, read_replica=False):
return ScoreSerializer(score).data
def delete_student_item(student_id, course_id, item_id):
"""
EFischer - dev testing this on my devstack, will document more fully after trying proof-of-concept
"""
# Retrieve the student item
try:
student_item = StudentItem.objects.get(
student_id=student_id, course_id=course_id, item_id=item_id
)
student_item.delete()
except StudentItem.DoesNotExist:
msg = (
u"No record found when deleting student item {item_id}"
u"in course {course_id} for student {student_id}."
).format(item_id=item_id, course_id=course_id, student_id=student_id)
logger.exception(msg)
raise SubmissionInternalError(msg)
except DatabaseError:
msg = (
u"Error occurred while reseting scores for"
u" item {item_id} in course {course_id} for student {student_id}"
).format(item_id=item_id, course_id=course_id, student_id=student_id)
logger.exception(msg)
raise SubmissionInternalError(msg)
else:
msg = u"Successfully deleted item {item_id} in course {course_id} for student {student_id}".format(
item_id=item_id, course_id=course_id, student_id=student_id
)
logger.info(msg)
def reset_score(student_id, course_id, item_id):
"""
Reset scores for a specific student on a specific problem.
......
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