Skip to content

Commit

Permalink
Merge branch 'hotfix/0.28.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
garethrees committed Apr 3, 2017
2 parents 3b7e3f4 + 1719a4e commit 8bb2c6c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/models/statistics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def by_week_to_today_with_noughts(counts_by_week, start_date)
earliest_week = start_date.to_date.at_beginning_of_week
latest_week = Date.current.at_beginning_of_week

counts_by_week.map! { |date, count| [date.to_s, count] }

(earliest_week..latest_week).step(7) do |date|
counts_by_week << [date.to_s, 0] unless counts_by_week.any? { |c| c.first == date.to_s }
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/alaveteli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
load "util.rb"

# Application version
ALAVETELI_VERSION = '0.28.0.4'
ALAVETELI_VERSION = '0.28.0.5'

# Add new inflection rules using the following format
# (all these examples are active by default):
Expand Down
7 changes: 7 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.28.0.5

# Highlighted Features

* Fix bug in `Statistics.by_week_to_today_with_noughts` causing comparisons to
fail (Gareth Rees)

# 0.28.0.4

# Highlighted Features
Expand Down
4 changes: 2 additions & 2 deletions spec/models/statistics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
describe ".by_week_to_today_with_noughts" do
it "adds missing weeks with noughts" do
data = [
["2016-01-04", 2],
["2016-01-18", 1]
[Date.parse("2016-01-04"), 2],
[Date.parse("2016-01-18"), 1]
]
date_from = Date.new(2015, 12, 28)
fake_current_date = Date.new(2016, 1, 31)
Expand Down

0 comments on commit 8bb2c6c

Please sign in to comment.