update script fixed

This commit is contained in:
Jun-te Kim 2026-02-20 13:18:12 +00:00
parent 3873da7109
commit eb893e4c6b
2 changed files with 7 additions and 8 deletions

View file

@ -104,12 +104,12 @@ class HubspotTodb:
),
soft_assert(
deal_in_db.coordination_status
== hs_listing.get("coordination_status__stage_1_"),
"uprn mismatch",
== hs_deal.get("coordination_status__stage_1_"),
"coordination stage 1 status mismatch",
),
soft_assert(
deal_in_db.design_status == hs_deal.get("retrofit_design_status"),
"outcome_notes mismatch",
"retrofit design mismatch",
),
]
@ -118,9 +118,8 @@ class HubspotTodb:
print(
f"❗ Discrepancies found for deal_id {deal_in_db.deal_id} — syncing with HubSpot."
)
return self.upsert_hubspot_deal(
hs_deal, hs_company_id, hs_listing, hubspot_client
)
self.upsert_hubspot_deal(hs_deal, hs_company_id, hs_listing, hubspot_client)
return False
# Handle photo upload if it exists but S3 URL is missing
if (
@ -157,6 +156,7 @@ class HubspotTodb:
session.add(db_record)
session.commit()
print(f"✅ Updated DB with S3 URL for deal_id={deal_in_db.deal_id}")
return False
else:
print(f"✅ No update or upload required for deal_id {deal_in_db.deal_id}.")
@ -169,7 +169,6 @@ class HubspotTodb:
Also uploads photos if present and adds S3 URL.
"""
with get_db_session() as session:
print("junte was here ")
print(deal_data)
deal_id = deal_data.get("hs_object_id")

View file

@ -15,7 +15,7 @@ deals_to_add = []
deal_to_companies = {}
for company_id in valuable_companies:
# 🔥 Cheap: company → deals
# 🔥 Cheap: company → deals
deal_ids = hubspot.get_deals_from_company(company_id)
for deal_id in tqdm(deal_ids, desc=f"Company {company_id}"):