File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -54,13 +54,16 @@ def location_statistics_data
5454
5555 sorted_times = times . sort
5656 total_participants = location . events . joins ( :results ) . count + location . events . joins ( :volunteers ) . count
57+ events_count = location . events . finalised . count
5758
5859 {
5960 location : location ,
6061 quickest_time : sorted_times . first ,
6162 average_time : ( times . sum . to_f / times . size ) . round ,
6263 median_time : sorted_times [ sorted_times . size / 2 ] ,
63- total_participants : total_participants
64+ total_participants : total_participants ,
65+ events_count : events_count ,
66+ average_participants : events_count . positive? ? ( total_participants . to_f / events_count ) . round : 0
6467 }
6568 end . compact
6669 end
Original file line number Diff line number Diff line change 4545 < dt class ="text-gray-600 "> Total Participants:</ dt >
4646 < dd class ="font-medium text-gray-950 "> <%= loc_stat [ :total_participants ] %> </ dd >
4747 </ div >
48+ < div class ="flex justify-between ">
49+ < dt class ="text-gray-600 "> Average Participants:</ dt >
50+ < dd class ="font-medium text-gray-950 "> <%= loc_stat [ :average_participants ] %> </ dd >
51+ </ div >
4852 < div class ="flex justify-between ">
4953 < dt class ="text-gray-600 "> Fastest Time:</ dt >
5054 < dd class ="font-medium text-gray-950 "> <%= format_pace_time ( loc_stat [ :quickest_time ] ) %> </ dd >
You can’t perform that action at this time.
0 commit comments