From 09809cc12ec0191427409428a31afdccd5ead391 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 20 Mar 2023 23:52:34 +0100 Subject: [PATCH] Preload error template attributes in SubmissionsController The join operation is okay, since a similar one is otherwise performed automatically by Rails --- app/controllers/submissions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index fd8dc55b..2f2bd9dc 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -353,7 +353,7 @@ class SubmissionsController < ApplicationController def extract_errors results = [] if @testrun[:output].present? - @submission.exercise.execution_environment.error_templates.each do |template| + @submission.exercise.execution_environment.error_templates.left_joins(:error_template_attributes).includes(:error_template_attributes).each do |template| pattern = Regexp.new(template.signature).freeze results << StructuredError.create_from_template(template, @testrun[:output], @submission) if pattern.match(@testrun[:output]) end