Send hints when scoring
This commit is contained in:
@ -197,9 +197,8 @@ class SubmissionsController < ApplicationController
|
||||
|
||||
def kill_socket(tubesock)
|
||||
# search for errors and save them as StructuredError (for scoring runs see submission_scoring.rb)
|
||||
extract_errors.each do | error |
|
||||
tubesock.send_data JSON.dump({cmd: 'hint', hint: error.hint, description: error.error_template.description})
|
||||
end
|
||||
errors = extract_errors
|
||||
send_hints(tubesock, errors)
|
||||
|
||||
# save the output of this "run" as a "testrun" (scoring runs are saved in submission_scoring.rb)
|
||||
save_run_output
|
||||
@ -307,11 +306,21 @@ class SubmissionsController < ApplicationController
|
||||
# to ensure responsiveness, we therefore open a thread here.
|
||||
Thread.new {
|
||||
tubesock.send_data JSON.dump(score_submission(@submission))
|
||||
|
||||
send_hints(tubesock, StructuredError.where(submission: @submission))
|
||||
|
||||
tubesock.send_data JSON.dump({'cmd' => 'exit'})
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def send_hints(tubesock, errors)
|
||||
errors = errors.to_a.uniq { |e| e.hint}
|
||||
errors.each do | error |
|
||||
tubesock.send_data JSON.dump({cmd: 'hint', hint: error.hint, description: error.error_template.description})
|
||||
end
|
||||
end
|
||||
|
||||
def set_docker_client
|
||||
@docker_client = DockerClient.new(execution_environment: @submission.execution_environment)
|
||||
end
|
||||
|
Reference in New Issue
Block a user