Class: Workarea::Segment::Rules::LastOrder

Inherits:
Base
  • Object
show all
Defined in:
app/models/workarea/segment/rules/last_order.rb

Instance Method Summary collapse

Methods inherited from Base

slug

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list

Methods included from Mongoid::Document

#embedded_children

Instance Method Details

#qualifies?(visit) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
# File 'app/models/workarea/segment/rules/last_order.rb', line 8

def qualifies?(visit)
  return false if days.blank?
  return !within if visit.metrics.last_order_at.blank?

  if within?
    visit.metrics.last_order_at >= days.days.ago
  else
    visit.metrics.last_order_at < days.days.ago
  end
end