mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Abri deal abandonment requires at least three parseable attempts 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
af85e0ed2b
commit
88093eb7cd
2 changed files with 15 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ from typing import Dict, List, Optional
|
|||
|
||||
from backend.app.db.models.hubspot_deal_data import HubspotDealData
|
||||
from etl.hubspot.project_data import ProjectData
|
||||
from etl.hubspot.utils import parse_hs_bool, parse_hs_date
|
||||
from etl.hubspot.utils import parse_hs_bool, parse_hs_date, parse_hs_int
|
||||
|
||||
|
||||
class HubspotDealDiffer:
|
||||
|
|
@ -226,7 +226,11 @@ class HubspotDealDiffer:
|
|||
new_project: Optional[ProjectData],
|
||||
old_deal: HubspotDealData,
|
||||
) -> bool:
|
||||
return HubspotDealDiffer._is_abri_condition_deal(new_deal, new_project)
|
||||
if not HubspotDealDiffer._is_abri_condition_deal(new_deal, new_project):
|
||||
return False
|
||||
|
||||
new_attempts = parse_hs_int(new_deal.get("number_of_attempts"))
|
||||
return new_attempts is not None and new_attempts >= 3
|
||||
|
||||
@staticmethod
|
||||
def check_for_magicplan_trigger(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,15 @@ def parse_hs_date(value: Optional[str]) -> Optional[datetime]:
|
|||
return None
|
||||
|
||||
|
||||
def parse_hs_int(value: Optional[str]) -> Optional[int]:
|
||||
if not value:
|
||||
return None
|
||||
try:
|
||||
return int(value)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
def parse_hs_bool(value: Optional[str]) -> Optional[bool]:
|
||||
if value is None or value == "":
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue