module BestBoy::Reporting

Public Class Methods

current_for(date, owner, type, source = nil) click to toggle source
# File lib/best_boy/reporting.rb, line 9
def current_for(date, owner, type, source = nil)
  self.for(owner, type, source).created_on(date)
end
current_or_create_for(owner, type, source = nil, date = Time.zone.now) click to toggle source
# File lib/best_boy/reporting.rb, line 13
def current_or_create_for(owner, type, source = nil, date = Time.zone.now)
  report = current_for(date, owner, type, source).last
  report.present? ? report : create_for(owner, type, source, date)
end
for(owner, type, source = nil) click to toggle source
# File lib/best_boy/reporting.rb, line 18
def for(owner, type, source = nil)
  where(owner_type: owner, event: type, event_source: source)
end