-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add submission status interaction with submissions API
- Loading branch information
1 parent
95def34
commit 1c06c78
Showing
4 changed files
with
87 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from mindmap.mindmap import SubmissionStatus | ||
|
||
|
||
def update_student_submission_status(*args, **kwargs): | ||
"""Update the submission status for a student after resetting their score.""" | ||
from submissions.api import get_submissions # pylint: disable=import-outside-toplevel | ||
from submissions.api import create_submission | ||
|
||
student_item_dict = { | ||
"student_id": kwargs.get("anonymous_user_id"), | ||
"item_id": kwargs.get("item_id"), | ||
"item_type": "mindmap", | ||
"course_id": kwargs.get("course_id"), | ||
} | ||
submissions = get_submissions(student_item_dict) | ||
if not submissions: | ||
return | ||
|
||
student_submission = submissions[0] | ||
new_answer = student_submission.get("answer") | ||
new_answer["submission_status"] = SubmissionStatus.NOT_ATTEMPTED.value | ||
|
||
create_submission(student_item_dict, new_answer) |