Use file name with file path as identifier

This commit is contained in:
Sebastian Serth
2021-12-15 00:43:42 +01:00
parent d543ac76ae
commit 0c1a10959c
11 changed files with 18 additions and 27 deletions

View File

@ -160,7 +160,7 @@ class Submission < ApplicationRecord
# @raise [Runner::Error] if the code could not be run due to a failure with the runner.
# See the specific type and message for more details.
def run(file, &block)
run_command = command_for execution_environment.run_command, file.name_with_extension
run_command = command_for execution_environment.run_command, file.filepath
durations = {}
prepared_runner do |runner, waiting_duration|
durations[:execution_duration] = runner.attach_to_execution(run_command, &block)
@ -185,7 +185,7 @@ class Submission < ApplicationRecord
end
def run_test_file(file, runner, waiting_duration)
test_command = command_for execution_environment.test_command, file.name_with_extension
test_command = command_for execution_environment.test_command, file.filepath
result = {file_role: file.role, waiting_for_container_time: waiting_duration}
output = runner.execute_command(test_command, raise_exception: false)
result.merge(output)
@ -222,7 +222,7 @@ class Submission < ApplicationRecord
end
def command_for(template, file)
filepath = collect_files.find {|f| f.name_with_extension == file }.filepath
filepath = collect_files.find {|f| f.filepath == file }.filepath
template % command_substitutions(filepath)
end
@ -255,7 +255,7 @@ class Submission < ApplicationRecord
waiting_for_container_time: output[:waiting_for_container_time]
)
filename = file.name_with_extension
filename = file.filepath
if file.teacher_defined_linter?
LinterCheckRun.create_from(testrun, assessment)