Add contestant export feature
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user