Class: OpportunityBriefing::StageResolver

Inherits:
Object
  • Object
show all
Defined in:
app/services/opportunity_briefing/stage_resolver.rb

Overview

Maps persisted opportunity/quote state to the sales briefing profile. Keeping
this deterministic prevents the model from inventing the lifecycle stage.

Constant Summary collapse

PROPOSAL_QUOTE_STATES =
%w[
  pending
  pending_project_details
  awaiting_completed_installation_plans
  profit_review
  pre_pack
  awaiting_transmission
  in_shipping_estimate
].freeze

Class Method Summary collapse

Class Method Details

.call(opportunity:, focus_quote: nil) ⇒ Object



16
17
18
19
20
21
22
# File 'app/services/opportunity_briefing/stage_resolver.rb', line 16

def self.call(opportunity:, focus_quote: nil)
  return 'promised' if opportunity.promised?
  return 'proposal_preparation' if proposal_preparation?(opportunity, focus_quote)
  return 'follow_up' if opportunity.follow_up? || focus_quote&.complete?

  'qualification'
end