Skip to content

Commit

Permalink
Fixes two runtime errors in leagues#show and leagues#registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
toomuchpete committed Sep 14, 2024
1 parent bbdb0a0 commit 984046a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/league.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ def get_team_roster_sizes
wm_registered = registrations.active.female.count
team_count = teams.count

return roster_size_params if team_count == 0

roster_size_params[:min_mm] = (mm_registered.to_f / team_count).floor
roster_size_params[:max_mm] = (mm_registered.to_f / team_count).ceil
roster_size_params[:teams_w_max_mm] = mm_registered % team_count
Expand Down
1 change: 1 addition & 0 deletions app/views/leagues/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@

- rank_data = {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0}
- @league.registrations.active.each do |r|
- next if r.rank.nil?
- rank_data[r.rank.floor.to_s.to_sym] += 1
- rank_js = ""
- rank_data.each do |k, v|
Expand Down

0 comments on commit 984046a

Please sign in to comment.