FIX: today visits not shown

This commit is contained in:
Erick Guan 2014-12-29 20:29:09 +08:00
parent b48f04e772
commit fe7f2c6979
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