mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Abri deal abandonment fires only when the deal newly becomes abandoned 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
9559f23741
commit
58ce855e0b
1 changed files with 16 additions and 4 deletions
|
|
@ -236,12 +236,14 @@ class HubspotDealDiffer:
|
|||
if not HubspotDealDiffer._is_abri_condition_deal(new_deal, new_project):
|
||||
return False
|
||||
|
||||
new_attempts = parse_hs_int(new_deal.get("number_of_attempts"))
|
||||
if new_attempts is None or new_attempts < 3:
|
||||
if HubspotDealDiffer._is_abandoned(
|
||||
old_deal.number_of_attempts, old_deal.outcome
|
||||
):
|
||||
return False
|
||||
|
||||
new_outcome = (new_deal.get("outcome") or "").lower()
|
||||
return new_outcome in HubspotDealDiffer.NEGATIVE_OUTCOMES
|
||||
return HubspotDealDiffer._is_abandoned(
|
||||
new_deal.get("number_of_attempts"), new_deal.get("outcome")
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def check_for_magicplan_trigger(
|
||||
|
|
@ -251,6 +253,16 @@ class HubspotDealDiffer:
|
|||
old_outcome = (old_deal.outcome or "").lower()
|
||||
return new_outcome == "surveyed" and old_outcome != "surveyed"
|
||||
|
||||
@staticmethod
|
||||
def _is_abandoned(
|
||||
number_of_attempts: Optional[str], outcome: Optional[str]
|
||||
) -> bool:
|
||||
attempts = parse_hs_int(number_of_attempts)
|
||||
if attempts is None or attempts < 3:
|
||||
return False
|
||||
|
||||
return (outcome or "").lower() in HubspotDealDiffer.NEGATIVE_OUTCOMES
|
||||
|
||||
@staticmethod
|
||||
def _is_abri_condition_deal(
|
||||
new_deal: Dict[str, str], new_project: Optional[ProjectData]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue