Preload error template attributes in SubmissionsController

The join operation is okay, since a similar one is otherwise performed automatically by Rails
This commit is contained in:
Sebastian Serth
2023-03-20 23:52:34 +01:00
parent e3e6fc3af1
commit 09809cc12e

View File

@ -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