Sha256: 7af208055c30e0d615f04b5918fabb3b3e5bd0518ed8fa1ca00c6df026bb6231

Contents?: true

Size: 415 Bytes

Versions: 7

Compression:

Stored size: 415 Bytes

Contents

# encoding: UTF-8
module Reports
  class AnalyticsWeekly
    include Mongoid::Document
    include Mongoid::Timestamps
    include ReportWeekly

    field :visitors, type: Integer, default: 0

    def update_report!
      daily_reports = AnalyticsDaily.gte(report_date: report_date).lte(report_date: report_date + 1.week - 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_weekly.rb
character-1.0.5 app/models/reports/analytics_weekly.rb
character-1.0.4 app/models/reports/analytics_weekly.rb
character-1.0.3 app/models/reports/analytics_weekly.rb
character-1.0.2 app/models/reports/analytics_weekly.rb
character-1.0.1 app/models/reports/analytics_weekly.rb
character-1.0.0 app/models/reports/analytics_weekly.rb