add last submission date to piepeline

This commit is contained in:
Jun-te Kim 2025-11-24 12:52:51 +00:00
parent 868d40bd5a
commit e26cf14540
3 changed files with 13 additions and 11 deletions

View file

@ -9,6 +9,7 @@ class Companies(Enum):
ABRI = "237615001799"
SOUTHERN_HOUSING_GROUP = "109343619305"
LIVEWEST = "86205872354"
HOMEGROUP = "94946071794"
class DealStage(Enum):
SURVEYED_COMPLETE_NEEDS_SIGN_OFF = "1617223914"

View file

@ -116,6 +116,7 @@ class HubSpotClientAsync:
'dealname',
'dealstage',
'expected_commencement_date',
'last_submission_date',
'mtp_planned_week',
'mtp_completion_date',
'design_planned_week',
@ -292,3 +293,5 @@ class HubSpotClientAsync:
results.append(await task)
return results

View file

@ -38,7 +38,6 @@ class jsonReader:
def generate_df_via_product_type(self, product_type):
rows = []
for deals in self.deals_by_line_item[product_type]:
if deals['attempts'] != []:
row = self._return_df_from_deal_info(deals, product_type)
rows.append(row)
break
@ -50,16 +49,15 @@ class jsonReader:
def _return_df_from_deal_info(self, deal, product_type):
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
)
}
data = {
"submission_date": deal["deal_properties"].get("submission_date", None),
"expected_commencement_date": deal["deal_properties"].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])