Skip to content

Commit 907249a

Browse files
committed
Sort linter results alphabetically if scored
1 parent 8523133 commit 907249a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/models/submission.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def calculate_score(requesting_user)
158158
score_file(output, file, requesting_user)
159159
end
160160
end
161-
# We sort the files again, so that the linter tests are displayed last.
162-
file_scores&.sort_by! {|file| file[:file_role] == 'teacher_defined_linter' ? 1 : 0 }
161+
# We sort the files again, so that *optional* linter tests are displayed last.
162+
# All other files are sorted alphabetically.
163+
file_scores&.sort_by! do |file|
164+
[file[:file_role] == 'teacher_defined_linter' && file[:weight].zero? ? 1 : 0, file[:filename]]
165+
end
163166
combine_file_scores(file_scores)
164167
end
165168

0 commit comments

Comments
 (0)