-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: exam end return url #171
Merged
+19
−11
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
from urllib.parse import urljoin | ||
|
||
from django.contrib.auth import login | ||
from django.http import JsonResponse | ||
from django.shortcuts import redirect | ||
from django.urls import reverse | ||
from django.views.decorators.http import require_http_methods | ||
|
@@ -27,6 +26,7 @@ | |
get_attempt_by_id, | ||
get_attempt_for_user_with_attempt_number_and_resource_id, | ||
get_exam_by_id, | ||
get_exam_url_path, | ||
update_attempt_status | ||
) | ||
from edx_exams.apps.core.exceptions import ExamIllegalStatusTransition | ||
|
@@ -290,11 +290,6 @@ def end_assessment(request, attempt_id): | |
|
||
update_attempt_status(attempt_id, ExamAttemptStatus.submitted) | ||
|
||
# user is authenticated via JWT so use that to create a | ||
# session with this service's authentication backend | ||
request.user.backend = EDX_OAUTH_BACKEND | ||
login(request, user) | ||
|
||
exam = attempt.exam | ||
resource_link_id = exam.resource_id | ||
end_assessment_return = get_end_assessment_return(request.user.anonymous_user_id, resource_link_id) | ||
|
@@ -303,6 +298,11 @@ def end_assessment(request, attempt_id): | |
# Platform MUST send an End Assessment message to the Proctoring Tool. Otherwise, the Assessment Platform can | ||
# complete its normal post-assessment flow. | ||
if end_assessment_return: | ||
# user is authenticated via JWT so use that to create a | ||
# session with this service's authentication backend | ||
request.user.backend = EDX_OAUTH_BACKEND | ||
login(request, user) | ||
|
||
lti_config_id = exam.provider.lti_configuration_id | ||
lti_config = LtiConfiguration.objects.get(id=lti_config_id) | ||
|
||
|
@@ -319,6 +319,7 @@ def end_assessment(request, attempt_id): | |
message_type='LtiEndAssessment', | ||
proctoring_launch_data=proctoring_launch_data, | ||
context_id=exam.course_id, | ||
launch_presentation_return_url=get_exam_url_path(exam.course_id, exam.content_id), | ||
) | ||
|
||
# TODO: "If the assessment needs to close due to an error NOT handled by the Assessment Platform that error MUST | ||
|
@@ -328,7 +329,7 @@ def end_assessment(request, attempt_id): | |
|
||
return redirect(preflight_url) | ||
|
||
return JsonResponse({}) | ||
return redirect(get_exam_url_path(exam.course_id, exam.content_id)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will leave us on a blank page with '{}'. If we don't need to perform an LtiEndAssessment launch return to the exam section. |
||
|
||
|
||
@api_view(['GET']) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this since it's only necessary if we're performing an end assessment launch