Move submission scoring from controller concern to submission model

Localization and markdown formatting is now done in a controller
spec in order to bring this logic away from the data and towards
the view.
This commit is contained in:
Felix Auringer
2021-06-11 12:01:16 +02:00
committed by Sebastian Serth
parent b847daf823
commit b6bc578aea
10 changed files with 188 additions and 143 deletions

View File

@ -5,6 +5,7 @@ class SubmissionsController < ApplicationController
include CommonBehavior
include Lti
include SubmissionParameters
include ScoringResultFormatting
include Tubesock::Hijack
before_action :set_submission,
@ -240,7 +241,7 @@ class SubmissionsController < ApplicationController
hijack do |tubesock|
return kill_socket(tubesock) if @embed_options[:disable_run]
tubesock.send_data(@submission.calculate_score)
tubesock.send_data(JSON.dump(format_scoring_results(@submission.calculate_score)))
# To enable hints when scoring a submission, uncomment the next line:
# send_hints(tubesock, StructuredError.where(submission: @submission))
rescue Runner::Error::ExecutionTimeout => e