Skip to content

Commit

Permalink
Sort linter results alphabetically if scored
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerth committed Oct 23, 2024
1 parent 8523133 commit 907249a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ def calculate_score(requesting_user)
score_file(output, file, requesting_user)
end
end
# We sort the files again, so that the linter tests are displayed last.
file_scores&.sort_by! {|file| file[:file_role] == 'teacher_defined_linter' ? 1 : 0 }
# We sort the files again, so that *optional* linter tests are displayed last.
# All other files are sorted alphabetically.
file_scores&.sort_by! do |file|
[file[:file_role] == 'teacher_defined_linter' && file[:weight].zero? ? 1 : 0, file[:filename]]
end
combine_file_scores(file_scores)
end

Expand Down

0 comments on commit 907249a

Please sign in to comment.