Sha256: 56417e45e9e47b14190156505141ad2fd5b0bb92cc213662bea302918cd4fcf5

Contents?: true

Size: 418 Bytes

Versions: 7

Compression:

Stored size: 418 Bytes

Contents

# encoding: UTF-8
module Reports
  class AnalyticsMonthly
    include Mongoid::Document
    include Mongoid::Timestamps
    include ReportMonthly

    field :visitors, type: Integer, default: 0

    def update_report!
      daily_reports = AnalyticsDaily.gte(report_date: report_date).lte(report_date: report_date + 1.month - 1.day)
      self.visitors = daily_reports.sum(:visitors)
      self.save!
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
character-1.0.6 app/models/reports/analytics_monthly.rb
character-1.0.5 app/models/reports/analytics_monthly.rb
character-1.0.4 app/models/reports/analytics_monthly.rb
character-1.0.3 app/models/reports/analytics_monthly.rb
character-1.0.2 app/models/reports/analytics_monthly.rb
character-1.0.1 app/models/reports/analytics_monthly.rb
character-1.0.0 app/models/reports/analytics_monthly.rb