Skip to content

Commit

Permalink
fix stats date range usage
Browse files Browse the repository at this point in the history
  • Loading branch information
codez committed Oct 23, 2019
1 parent f918424 commit 4283a10
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/services/stats/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def initialize(date_range)
private

def tracks
Track.within(date_range.first, date_range.last).joins(:broadcast)
Track
.within(date_range.first.at_beginning_of_day, date_range.last.at_end_of_day)
.joins(:broadcast)
end

def sort_counts(counts)
Expand Down
2 changes: 1 addition & 1 deletion app/services/stats/shows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def to_csv
private

def broadcasts
Broadcast.within(date_range.first, date_range.last)
Broadcast.within(date_range.first.at_beginning_of_day, date_range.last.at_end_of_day)
end

def sum_hours_by_show(scope, table)
Expand Down
2 changes: 1 addition & 1 deletion test/services/stats/shows_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Stats::ShowsTest < ActiveSupport::TestCase
end

def stats
@stats ||= Stats::Shows.new(Date.new(2013,5,16)..Date.new(2013,6,15))
@stats ||= Stats::Shows.new(Date.new(2013,5,16)..Date.new(2013,6,12))
end

end

0 comments on commit 4283a10

Please sign in to comment.