stats: display the last day of the range (instead of the first day)
This commit is contained in:
parent
908771e172
commit
ac88d1cc1d
1 changed files with 4 additions and 2 deletions
|
@ -146,11 +146,13 @@ class StatsController < ApplicationController
|
||||||
.count
|
.count
|
||||||
.map do |week, count|
|
.map do |week, count|
|
||||||
total = totals[week]
|
total = totals[week]
|
||||||
|
# By default a week is displayed by the first day of the week – but we'd rather display the last day
|
||||||
|
label = week.next_week
|
||||||
|
|
||||||
if total > 0
|
if total > 0
|
||||||
[week, (count.to_f / total * 100).round(2)]
|
[label, (count.to_f / total * 100).round(2)]
|
||||||
else
|
else
|
||||||
[week, 0]
|
[label, 0]
|
||||||
end
|
end
|
||||||
end.to_h
|
end.to_h
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue