Class: SpreeCmCommissioner::LineItems::SyncEventDate
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::LineItems::SyncEventDate
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/line_items/sync_event_date.rb
Instance Method Summary collapse
Instance Method Details
#call(event:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/spree_cm_commissioner/line_items/sync_event_date.rb', line 6 def call(event:) return failure(:invalid_event_kind) unless event.event? return failure(:invalid_event_depth) unless event.depth == 1 event.event_line_items.includes(:variant).find_each do |line_item| line_item.send(:set_duration) # Update could be failed here if case line item does not allowed to change or no longer available. # We can ignore this line item in this case. line_item.save if line_item.from_date_changed? || line_item.to_date_changed? end success(nil) end |