From 57a8058ef71603e5e5c9911a4b9e8ffe205cff9c Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 13 Oct 2024 21:53:28 +0200 Subject: [PATCH] Improve file filtering for submission execution Previously, many different executions got all files despite not necessary needed. We now extend the file filtering to apply for submit actions, remote evaluations and test executions, too. --- app/models/submission.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/models/submission.rb b/app/models/submission.rb index e93c722b4..094f1c1f0 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -218,10 +218,16 @@ def prepared_runner files = collect_files case cause - when 'run' - files.reject!(&:reference_implementation?) - files.reject!(&:teacher_defined_assessment?) - when 'assess' + when 'run', 'test' + files.reject! do |file| + next true if file.reference_implementation? + # Only remove teacher-defined assessments if they are hidden. + # Otherwise, 'test' might fail if a teacher-defined assessment is executed. + next true if file.teacher_defined_assessment? && file.hidden? + + next false + end + when 'assess', 'submit', 'remoteAssess', 'remoteSubmit' regular_filepaths = files.reject(&:reference_implementation?).map(&:filepath) files.reject! {|file| file.reference_implementation? && regular_filepaths.include?(file.filepath) } end