Merge pull request #3065 from fantasticfears/fix-visits-report

FIX: today visits not shown
This commit is contained in:
Régis Hanol 2014-12-29 21:23:47 +01:00
commit a04f44d65a
2 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class Report
end
def self.report_visits(report)
basic_report_about report, UserVisit, :by_day, report.start_date, report.end_date
basic_report_about report, UserVisit, :by_day, report.start_date, report.end_date.change(hour: 24)
end
def self.report_signups(report)

View File

@ -15,6 +15,7 @@ describe Report do
let(:user) { Fabricate(:user) }
before do
user.user_visits.create(visited_at: 1.hour.ago)
user.user_visits.create(visited_at: 1.day.ago)
user.user_visits.create(visited_at: 2.days.ago)
end
@ -22,6 +23,10 @@ describe Report do
it "returns a report with data" do
report.data.should be_present
end
it "return today's visit" do
report.data.select { |v| v[:x].today? }.should be_present
end
end
end