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:
Daniel Roth 2026-07-03 10:12:59 +00:00
parent 6de0da869e
commit 9559f23741
2 changed files with 29 additions and 0 deletions

View file

@ -23,6 +23,7 @@ class HubspotDealData(SQLModel, table=True):
landlord_property_id: Optional[str] = Field(default=None)
uprn: Optional[str] = Field(default=None)
outcome: Optional[str] = Field(default=None)
number_of_attempts: Optional[str] = Field(default=None)
outcome_notes: Optional[str] = Field(default=None)
booking_status: Optional[str] = Field(default=None)

View file

@ -1043,6 +1043,34 @@ def test_abri_deal_abandonment__each_negative_outcome__returns_true(
assert result is True
def test_abri_deal_abandonment__deal_already_abandoned__returns_false() -> None:
deal_id = uuid.uuid4()
# Arrange
old_deal = make_old_deal(
id=deal_id,
project_code="Abri Condition",
number_of_attempts="3",
outcome="No Answer",
)
new_deal = make_new_deal(
deal_id,
project_code="Abri Condition",
number_of_attempts="4",
outcome="No Answer",
)
# Act
result = HubspotDealDiffer.check_for_abri_deal_abandonment(
new_deal=new_deal,
new_project=None,
old_deal=old_deal,
)
# Assert
assert result is False
# =======================
# DB UPDATE TRIGGER TESTS
# =======================