Class: PartnerService::Reports::SoldOutService
- Inherits:
-
BaseService
- Object
- BaseService
- PartnerService::Reports::SoldOutService
- Defined in:
- app/services/partner_service/reports/sold_out_service.rb
Constant Summary collapse
- LUNCH_TIME_RANGE =
('12:00'..'16:00').freeze
- DINNER_TIME_RANGE =
('16:00'..'23:45').freeze
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
Methods inherited from BaseService
#build_reports_by_day, #build_reports_by_hour, #initialize
Methods included from CopperHelper
Constructor Details
This class inherits a constructor from PartnerService::Reports::BaseService
Instance Method Details
#build_sold_out_report ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/partner_service/reports/sold_out_service.rb', line 7 def build_sold_out_report date = params.require(:date).to_date time_type = params.require(:time_type) return empty_sold_out_report(date) if restaurants.blank? data_cache_key = cache_key(fetch_reservations(date).cache_key) Rails.cache.fetch(data_cache_key) do reservations = fetch_reservations(date) reservations = filter_reservations_by_time_type(reservations, time_type) generate_sold_out_report(reservations, date, time_type) end end |