Skip to content

Commit

Permalink
Fix minor issues (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannis authored Sep 13, 2023
1 parent b1946a1 commit fe9ec49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/admin/cup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,19 @@ def find_resource
member_action :download_kenshi_list, method: :get do
@cup = Cup.all.detect { |c| c.year.to_i == params[:id].to_i }
kenshis = @cup.kenshis
.includes(:user, :club, participations: :category, purchases: :product).order(:last_name, :first_name)
csv = CSV.generate do |csv|
header = ["Last name", "First name", "Club", "Dob", "Grade"]
header = ["Last name", "First name", "Inscrit par (nom)", "Inscrit par (email)", "Club", "Dob", "Grade"]
[@cup.team_categories, @cup.individual_categories, @cup.products].flatten.each do |tc|
header << tc.name
end
csv << header.flatten
kenshis.each do |kenshi|
kcsv = [kenshi.norm_last_name, kenshi.norm_first_name, kenshi.club.name, kenshi.dob, kenshi.grade]
user = kenshi.user
kcsv = [
kenshi.norm_last_name, kenshi.norm_first_name, user.full_name, user.email,
kenshi.club.name, kenshi.dob, kenshi.grade
]
@cup.team_categories.each do |tc|
kcsv << (kenshi.takes_part_to?(tc) ? kenshi.participations.to(tc).first.team : nil)
end
Expand All @@ -180,6 +185,7 @@ def find_resource
@cup.products.each do |p|
kcsv << (kenshi.consume?(p) ? p.name : nil)
end
csv << kcsv.flatten
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
%>
<%=
link_to(
t("navigation.teams.text", teams: current_cup.teams.count),
t("navigation.teams.text", teams: current_cup.teams.joins(:participations).distinct.count),
cup_teams_path(current_cup),
title: t("navigation.teams.title").html_safe,
class: "text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
Expand Down

0 comments on commit fe9ec49

Please sign in to comment.