Add new file role teacher_defined_linter

This commit is contained in:
Sebastian Serth
2020-10-15 00:43:57 +02:00
parent a5416758eb
commit be3ec82bd4
17 changed files with 41 additions and 28 deletions

View File

@ -263,7 +263,7 @@ class Exercise < ApplicationRecord
FROM files
WHERE context_type = 'Exercise'
AND context_id = #{id}
AND role = 'teacher_defined_test'
AND role IN ('teacher_defined_test', 'teacher_defined_linter')
GROUP BY context_id),
-- filter for rows containing max points
time_max_score AS
@ -392,7 +392,7 @@ class Exercise < ApplicationRecord
WHERE exercise_id = #{id} AND user_id = #{user.id} AND user_type = '#{user_type}'
GROUP BY user_id, id, exercise_id),
MAX_POINTS AS
(SELECT context_id AS ex_id, sum(weight) AS max_points FROM files WHERE context_type = 'Exercise' AND context_id = #{id} AND role = 'teacher_defined_test' GROUP BY context_id),
(SELECT context_id AS ex_id, sum(weight) AS max_points FROM files WHERE context_type = 'Exercise' AND context_id = #{id} AND role IN ('teacher_defined_test', 'teacher_defined_linter') GROUP BY context_id),
-- filter for rows containing max points
TIME_MAX_SCORE AS
@ -506,7 +506,7 @@ class Exercise < ApplicationRecord
0
end
else
files.teacher_defined_tests.sum(:weight)
files.teacher_defined_assessments.sum(:weight)
end
end