add cause to testruns
trigger run and assess on request_for_comment
This commit is contained in:

committed by
Maximilian Grundke

parent
6dc34d3ebe
commit
194984a620
@@ -9,7 +9,7 @@ module SubmissionScoring
|
||||
assessment = assessor.assess(output)
|
||||
passed = ((assessment[:passed] == assessment[:count]) and (assessment[:score] > 0))
|
||||
testrun_output = passed ? nil : output[:stderr]
|
||||
Testrun.new(submission: submission, file: file, passed: passed, output: testrun_output).save
|
||||
Testrun.new(submission: submission, cause: 'assess', file: file, passed: passed, output: testrun_output).save
|
||||
output.merge!(assessment)
|
||||
output.merge!(filename: file.name_with_extension, message: feedback_message(file, output[:score]), weight: file.weight)
|
||||
end
|
||||
|
@@ -1,4 +1,5 @@
|
||||
class RequestForCommentsController < ApplicationController
|
||||
include SubmissionScoring
|
||||
before_action :set_request_for_comment, only: [:show, :edit, :update, :destroy, :mark_as_solved, :set_thank_you_note]
|
||||
|
||||
skip_after_action :verify_authorized
|
||||
@@ -107,6 +108,10 @@ class RequestForCommentsController < ApplicationController
|
||||
@request_for_comment = RequestForComment.new(request_for_comment_params)
|
||||
respond_to do |format|
|
||||
if @request_for_comment.save
|
||||
# create thread here and execute tests. A run is triggered from the frontend and does not need to be handled here.
|
||||
Thread.new do
|
||||
score_submission(@request_for_comment.submission)
|
||||
end
|
||||
format.json { render :show, status: :created, location: @request_for_comment }
|
||||
else
|
||||
format.html { render :new }
|
||||
|
@@ -262,7 +262,7 @@ class SubmissionsController < ApplicationController
|
||||
def save_run_output
|
||||
if !@message_buffer.blank?
|
||||
@message_buffer = @message_buffer[(0..max_message_buffer_size-1)] # trim the string to max_message_buffer_size chars
|
||||
Testrun.create(file: @file, submission: @submission, output: @message_buffer)
|
||||
Testrun.create(file: @file, cause: 'run', submission: @submission, output: @message_buffer)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user