Add contestant export feature
Some checks failed
CI / scan_ruby (push) Failing after 1m5s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 36s

This commit is contained in:
sto
2025-10-28 10:19:19 +01:00
parent 916c7af738
commit 1fa7bf10ec
7 changed files with 27 additions and 1 deletions

View File

@@ -111,6 +111,19 @@ class ContestantsController < ApplicationController
end
end
def export
authorize @contest
@contestants = @contest.contestants.sort_by { |contestant| [ -contestant.completions.size, contestant.time_seconds ] }
respond_to do |format|
format.csv do
response.headers["Content-Type"] = "text/csv"
response.headers["Content-Disposition"] = "attachment; filename=export.csv"
end
end
end
private
def set_contest