Merge pull request #6 from Hestia-Homes/feature/make_dashboard_better_for_one

save current
This commit is contained in:
Jun-te Kim 2025-11-24 12:54:18 +00:00 committed by GitHub
commit bbf1f5368f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View file

@ -3,7 +3,6 @@ import asyncio
from hubspot.crm.associations import ApiException
import hubspot
class HubSpotClientAsync:
API_CONCURRENCY = asyncio.Semaphore(5) # globally limit concurrency
RATE_LIMIT_DELAY = 0.25 # 4 requests/sec → safe

View file

@ -2,6 +2,10 @@ from pprint import pprint
from collections import defaultdict
import pandas as pd
from enum import Enum
class ProductType(Enum):
EMPTY_CAVITY_ECO_4 = "Empty Cavity - ECO4"
@ -37,6 +41,7 @@ class jsonReader:
if deals['attempts'] != []:
row = self._return_df_from_deal_info(deals, product_type)
rows.append(row)
break
if rows:
return pd.concat(rows, ignore_index=True)
@ -45,16 +50,17 @@ class jsonReader:
def _return_df_from_deal_info(self, deal, product_type):
print(deal)
data = {
"submission_date": deal.get("submission_date", None),
"expected_commencement_date": deal.get("expected_commencement_date", None),
"work_type": product_type,
"price": next(
(item["price"] for item in deal["line_items"] if product_type in item["name"]),
None
)
}
for attempts in deal["attempts"]:
data = {
"submission_date": deal.get("submission_date", None),
"expected_commencement_date": deal.get("expected_commencement_date", None),
"work_type": product_type,
"price": next(
(item["price"] for item in deal["line_items"] if product_type in item["name"]),
None
)
}
return pd.DataFrame([data])
def find_all_job_with_line_item(self):