mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
22 lines
563 B
Ruby
22 lines
563 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Reports::MobileVisits
|
|
extend ActiveSupport::Concern
|
|
|
|
class_methods do
|
|
def report_mobile_visits(report)
|
|
basic_report_about report, UserVisit, :mobile_by_day, report.start_date, report.end_date
|
|
report.total = UserVisit.where(mobile: true).count
|
|
report.prev30Days =
|
|
UserVisit
|
|
.where(mobile: true)
|
|
.where(
|
|
"visited_at >= ? and visited_at < ?",
|
|
report.start_date - 30.days,
|
|
report.start_date,
|
|
)
|
|
.count
|
|
end
|
|
end
|
|
end
|