diff --git a/etl/hubSpotClient/hubspot.py b/etl/hubSpotClient/hubspot.py index 49d2199..303be66 100644 --- a/etl/hubSpotClient/hubspot.py +++ b/etl/hubSpotClient/hubspot.py @@ -6,6 +6,7 @@ from etl.hubSpotClient.types import SubmissionInfoFromDeal class DealStage(Enum): SURVEYED_COMPLETE_NEEDS_SIGN_OFF = "1617223914" SURVEYED_NO_ACCESS_NEED_SIGN_OFF = "1617223915" + CUSTOMER_CONTACTED = "888730834" class HubSpotClient(): def __init__(self): @@ -17,24 +18,36 @@ class HubSpotClient(): def get_deals_from_deal_stage(self, deal_stage: DealStage): - search_request = PublicObjectSearchRequest( - filter_groups=[{ - "filters": [{ - "propertyName": "dealstage", - "operator": "EQ", - "value": deal_stage.value, - }] - }], - properties=[ - "dealname", - "number_of_wet_rooms_needing_ventilation", - "work_type", - "property_needs_trickle_vents", - "domna_survey_post_sap", - "existing_wall_insulation" - ], - ) - found_deals = self.client.crm.deals.search_api.do_search(search_request) + found_deals = [] + after = None + while True: + print("hello world") + search_request = PublicObjectSearchRequest( + filter_groups=[{ + "filters": [{ + "propertyName": "dealstage", + "operator": "EQ", + "value": deal_stage.value, + }] + }], + properties=[ + "dealname", + "number_of_wet_rooms_needing_ventilation", + "work_type", + "property_needs_trickle_vents", + "domna_survey_post_sap", + "existing_wall_insulation" + ], + limit=20 + after=after + ) + response = self.client.crm.deals.search_api.do_search(search_request) + found_deals.extend(response.results) + if not response.paging or not response.paging.next: + break + after = response.paging.next.after + return found_deals + all_deals = [] if hasattr(found_deals, "results"): for deal in found_deals.results: diff --git a/etl/hubspot_to_deemed_calculator.py b/etl/hubspot_to_deemed_calculator.py index 1c5c93e..7dcb212 100644 --- a/etl/hubspot_to_deemed_calculator.py +++ b/etl/hubspot_to_deemed_calculator.py @@ -12,8 +12,9 @@ os.environ["JJC_SERVICE_SHAREPOINT_ID"] = "7fdd0485-bbf3-4b29-b30f-98c81c2a6284" hubSpotClient = HubSpotClient() -deals = hubSpotClient.get_deals_from_deal_stage(DealStage.SURVEYED_COMPLETE_NEEDS_SIGN_OFF) +deals = hubSpotClient.get_deals_from_deal_stage(DealStage.CUSTOMER_CONTACTED) +hubSpotClient.print_all_pipeline_ids() csv_list = [] @@ -121,4 +122,11 @@ print("Excel file 'survey_data.xlsx' created successfully!") +# All three installers + + +# Rate card +# Different installer detection detection +# Sheet for each installer +# Uploaded into sharepoint -> Adminstrators -> different location -> one document per housing association \ No newline at end of file