Add user to testrun
* We want to identify a user that has triggered a testrun. Previously (in regular operation), only submission author who were regular users were able to start a testrun. Now, we want to prepare a future where submission authors are programming groups. Still, a testrun is triggered by an individual user and not a group. * Further, this commit fixes some missing foreign key constrains.
This commit is contained in:

committed by
Sebastian Serth

parent
e3603758ef
commit
be4f2b790d
@ -525,7 +525,7 @@ class ExercisesController < ApplicationController
|
||||
|
||||
def submit
|
||||
@submission = Submission.create(submission_params)
|
||||
@submission.calculate_score
|
||||
@submission.calculate_score(current_user)
|
||||
|
||||
if @submission.users.map {|user| lti_outcome_service?(@submission.exercise, user, @submission.study_group_id) }.any?
|
||||
transmit_lti_score
|
||||
|
@ -66,7 +66,7 @@ class RemoteEvaluationController < ApplicationController
|
||||
validation_token = remote_evaluation_params[:validation_token]
|
||||
if (remote_evaluation_mapping = RemoteEvaluationMapping.find_by(validation_token:))
|
||||
@submission = Submission.create(build_submission_params(cause, remote_evaluation_mapping))
|
||||
@submission.calculate_score
|
||||
@submission.calculate_score(remote_evaluation_mapping.user)
|
||||
else
|
||||
# TODO: better output
|
||||
# TODO: check token expired?
|
||||
|
@ -157,7 +157,7 @@ class RequestForCommentsController < ApplicationController
|
||||
# execute the tests here and wait until they finished.
|
||||
# As the same runner is used for the score and test run, no parallelization is possible
|
||||
# A run is triggered from the frontend and does not need to be handled here.
|
||||
@request_for_comment.submission.calculate_score
|
||||
@request_for_comment.submission.calculate_score(current_user)
|
||||
format.json { render :show, status: :created, location: @request_for_comment }
|
||||
else
|
||||
format.html { render :new }
|
||||
|
@ -249,7 +249,7 @@ class SubmissionsController < ApplicationController
|
||||
return true if disable_scoring
|
||||
|
||||
# The score is stored separately, we can forward it to the client immediately
|
||||
client_socket&.send_data(JSON.dump(@submission.calculate_score))
|
||||
client_socket&.send_data(JSON.dump(@submission.calculate_score(current_user)))
|
||||
# To enable hints when scoring a submission, uncomment the next line:
|
||||
# send_hints(client_socket, StructuredError.where(submission: @submission))
|
||||
rescue Runner::Error => e
|
||||
@ -284,7 +284,7 @@ class SubmissionsController < ApplicationController
|
||||
return true if @embed_options[:disable_run]
|
||||
|
||||
# The score is stored separately, we can forward it to the client immediately
|
||||
client_socket&.send_data(JSON.dump(@submission.test(@file)))
|
||||
client_socket&.send_data(JSON.dump(@submission.test(@file, current_user)))
|
||||
rescue Runner::Error => e
|
||||
extract_durations(e)
|
||||
send_and_store client_socket, {cmd: :status, status: :container_depleted}
|
||||
@ -396,6 +396,7 @@ class SubmissionsController < ApplicationController
|
||||
passed: @testrun[:passed],
|
||||
cause:,
|
||||
submission: @submission,
|
||||
user: current_user,
|
||||
exit_code: @testrun[:exit_code], # might be nil, e.g., when the run did not finish
|
||||
status: @testrun[:status] || :failed,
|
||||
output: @testrun[:output].presence, # TODO: Remove duplicated saving of the output after creating TestrunMessages
|
||||
|
Reference in New Issue
Block a user