Skip to content

Commit e9a4123

Browse files
MrSerthDome-GER
authored andcommitted
Remote evaluation: Include submission as HTTP location header
1 parent 471e95c commit e9a4123

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

app/controllers/remote_evaluation_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ def evaluate
1818
result = create_and_score_submission('remoteAssess')
1919
# For this route, we don't want to display the LTI result, but only the result of the submission.
2020
try_lti if result.key?(:feedback)
21-
render json: result.fetch(:feedback, result), status: result.fetch(:status, 201)
21+
location = submission_url(@submission) if @submission
22+
render json: result.fetch(:feedback, result), status: result.fetch(:status, 201), location:
2223
end
2324

2425
# POST /submit
2526
def submit
2627
result = create_and_score_submission('remoteSubmit')
2728
result = try_lti if result.key?(:feedback)
28-
render json: result, status: result.fetch(:status, 201)
29+
location = submission_url(@submission) if @submission
30+
render json: result, status: result.fetch(:status, 201), location:
2931
end
3032

3133
private

docs/remote_evaluation.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,13 @@ components:
520520
- de
521521
default: en
522522
description: An ISO-639 language code used to select appropriate localized messages. The same languages as available in CodeOcean's web UI are supported.
523+
headers:
524+
Location:
525+
schema:
526+
type: string
527+
format: iri
528+
example: 'https://codeocean.openhpi.de/submissions/1'
529+
description: The URL of the newly created submission that was received by CodeOcean.
523530
responses:
524531
200Ok:
525532
description: This response indicates that the learner has reached the full score on the exercise and that the score was successfully submitted via LTI to the e-learning platform.
@@ -530,6 +537,9 @@ components:
530537
examples:
531538
OkResponse:
532539
$ref: '#/components/examples/OkResponse'
540+
headers:
541+
Location:
542+
$ref: '#/components/headers/Location'
533543
201Created:
534544
description: |-
535545
This response indicates that the requested tests were run successfully against the provided submission. The HTTP status code does not indicate whether all tests passed or failed. Rather, it confirms the successful command execution in the container and that the files were correctly stored in the learner's workspace for the given exercise. The response body contains an array of evaluation responses, in which each element represents the result of a test run.
@@ -544,6 +554,9 @@ components:
544554
$ref: '#/components/examples/PythonSuccessfulEvaluation'
545555
PythonFailedEvaluation:
546556
$ref: '#/components/examples/PythonFailedEvaluation'
557+
headers:
558+
Location:
559+
$ref: '#/components/headers/Location'
547560
202Accepted:
548561
description: 'This response indicates that the learner has scored their submission successfully without reaching the full score. This score, despite not representing the full score possible, was submitted successfully via LTI to the e-learning platform.'
549562
content:
@@ -553,6 +566,9 @@ components:
553566
examples:
554567
AcceptedResponse:
555568
$ref: '#/components/examples/AcceptedResponse'
569+
headers:
570+
Location:
571+
$ref: '#/components/headers/Location'
556572
207MultiStatus:
557573
description: 'This response indicates that the learner has scored their submission successfully but also indicates that the submission was received too late. The score returned in the response is the original, unmodified evaluation of the submission. To the e-learning platform, however, only 80% of this score were transmitted to account for the late submission. The transmission of this reduced score via LTI to the e-learning platform was successful.'
558574
content:
@@ -562,6 +578,9 @@ components:
562578
examples:
563579
MultiStatusResponse:
564580
$ref: '#/components/examples/MultiStatusResponse'
581+
headers:
582+
Location:
583+
$ref: '#/components/headers/Location'
565584
401Unauthorized:
566585
description: This response indicates that the the `validation_token` sent in the request was either not found or invalid.
567586
content:
@@ -580,6 +599,9 @@ components:
580599
examples:
581600
ConflictResponse:
582601
$ref: '#/components/examples/ConflictResponse'
602+
headers:
603+
Location:
604+
$ref: '#/components/headers/Location'
583605
410Gone:
584606
description: 'This response indicates that the learner has scored their submission successfully but also indicates that the transmission of the score to the e-learning platform was not attempted. This is usually caused by missing LTI parameters for the given exercise. Reopening the exercise in CodeOcean through the e-learning platform will update the LTI parameters and might fix the problem if the e-learning platform still accepts submissions for the activity. Some e-learning platforms like Xikolo might not include the required LTI parameters after the respective submission deadline has passed, in which this error cannot be fixed by the learner.'
585607
content:
@@ -589,6 +611,9 @@ components:
589611
examples:
590612
GoneResponse:
591613
$ref: '#/components/examples/GoneResponse'
614+
headers:
615+
Location:
616+
$ref: '#/components/headers/Location'
592617
417ExpectationFailed:
593618
description: 'This response indicates that the learner has scored their submission successfully but also indicates mixed success for the transmission of scores to the e-learning platform as part of an ongoing pair programming session. Specifically, the score was sent successfully for the requesting learner, but failed to be submitted for at least one of the fellow learners. Similar to a `424 Failed Dependency` response, this is usually caused by invalid or expired LTI parameters for the given exercise and learner. Hence, the partner(s) are advised to reopen the exercise in CodeOcean through the e-learning platform and thereby update the LTI parameters. This might fix the problem if the e-learning platform still accepts submissions for the activity. Some e-learning platforms like Xikolo might not include the required LTI parameters after the respective submission deadline has passed, in which this error cannot be fixed by the partner(s). The learner requesting the evaluation and score submission cannot fix the problem on their own, but needs to wait for their partner(s) to perform the previously-outlined steps.'
594619
content:
@@ -598,6 +623,9 @@ components:
598623
examples:
599624
ExpectationFailedResponse:
600625
$ref: '#/components/examples/ExpectationFailedResponse'
626+
headers:
627+
Location:
628+
$ref: '#/components/headers/Location'
601629
424FailedDependency:
602630
description: 'This response indicates that the learner has scored their submission successfully but also indicates that the transmission of scores to the e-learning platform failed. This status either indicates that the transmission of the score failed for the requesting user in a context without pair programming or that it failed for all partners including the requesting user in a pair programming session. This is usually caused by invalid or expired LTI parameters for the given exercise or a a temporary availability issue of the e-learning platform. If the e-learning platform is available, the learner(s) are advised to reopen the exercise in CodeOcean through the e-learning platform and thereby update the LTI parameters. This might fix the problem if the e-learning platform still accepts submissions for the activity. Some e-learning platforms like Xikolo might not include the required LTI parameters after the respective submission deadline has passed, in which this error cannot be fixed by the learner(s).'
603631
content:
@@ -607,6 +635,9 @@ components:
607635
examples:
608636
FailedDependencyResponse:
609637
$ref: '#/components/examples/FailedDependencyResponse'
638+
headers:
639+
Location:
640+
$ref: '#/components/headers/Location'
610641
422UnprocessableContent:
611642
description: 'This response indicates that the request received could not be parsed correctly. This either indicates that the request body was no valid JSON at all or that the JSON received was not in the expected format. Retrying again with a schema-compliant JSON will likely succeed and result in a different status code. '
612643
content:
@@ -625,6 +656,9 @@ components:
625656
examples:
626657
ServiceUnavailableResponse:
627658
$ref: '#/components/examples/ServiceUnavailableResponse'
659+
headers:
660+
Location:
661+
$ref: '#/components/headers/Location'
628662
tags:
629663
- name: remote evaluation
630664
description: Everything related to remote code evaluation

0 commit comments

Comments
 (0)