Class: Rawbotz::Models::Sales
- Inherits:
-
Object
- Object
- Rawbotz::Models::Sales
- Includes:
- ActiveModel::Model
- Defined in:
- lib/rawbotz/models/sales.rb
Class Method Summary collapse
- .daily_since(product_id, num_days = 30) ⇒ Object
- .monthly_since(product_id, num_months = 12) ⇒ Object
Class Method Details
.daily_since(product_id, num_days = 30) ⇒ Object
9 10 11 12 |
# File 'lib/rawbotz/models/sales.rb', line 9 def self.daily_since product_id, num_days=30 RawgentoDB::Query.sales_daily_between(product_id, Date.today, Date.today - num_days) end |
.monthly_since(product_id, num_months = 12) ⇒ Object
14 15 16 17 18 |
# File 'lib/rawbotz/models/sales.rb', line 14 def self.monthly_since product_id, num_months=12 # Todo create a date num_month month ago (vs x*30) RawgentoDB::Query.sales_monthly_between(product_id, Date.today, Date.today - (num_months * 30)).uniq end |