mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
23 lines
No EOL
814 B
Python
23 lines
No EOL
814 B
Python
from etl.hubSpotClient.hubspotClient import HubSpotClient, Companies, Pipeline
|
|
from tqdm import tqdm
|
|
from etl.db.hubSpotLoad import HubspotTodb
|
|
|
|
hubspot = HubSpotClient()
|
|
db = HubspotTodb()
|
|
|
|
records = db.find_all_deals_with_company_id(Companies.ABRI.value)
|
|
|
|
updated_count = 0 # Counter for deals that needed updating
|
|
checked_count = 0 # Optional: total processed counter
|
|
|
|
for deal in tqdm(records, desc="Checking HubSpot deals"):
|
|
checked_count += 1
|
|
was_up_to_date = db.update_deal(deal, hubspot)
|
|
|
|
# update_deal() returns False when discrepancies are found
|
|
if not was_up_to_date:
|
|
updated_count += 1
|
|
|
|
print(f"\n✅ Finished checking {checked_count} deals.")
|
|
print(f"🧩 {updated_count} deal(s) were updated.")
|
|
print(f"📈 {checked_count - updated_count} deal(s) were already up to date.") |