diff --git a/etl/surveyPrice/surveyPrice.py b/etl/surveyPrice/surveyPrice.py index 2c86fba..e27680f 100644 --- a/etl/surveyPrice/surveyPrice.py +++ b/etl/surveyPrice/surveyPrice.py @@ -1,4 +1,5 @@ from etl.scraper.scraper import SharePointScraper, SharePointInstaller +from etl.hubSpotClient.hubspot import HubSpotClient, DealStage import pandas as pd @@ -9,6 +10,7 @@ class SurveyPrice(): def __init__(self): self.sharepoint_client = SharePointScraper(SharePointInstaller.WARMFRONT) self.master_rate_card_path = None + self.all_hubspot_submissions = None self.download_price_card() self.required_sheets = [ 'JJC - EMPTIES', @@ -80,9 +82,26 @@ class SurveyPrice(): pricing_table = pd.DataFrame(pricing_table) return pricing_table - def get_all_surveys_from_hubspot(): - # TODO Get all hubspot data and make a dataframe - pass + def get_all_surveys_from_hubspot(self): + hubSpotClient = HubSpotClient() + deals = hubSpotClient.get_deals_from_deal_stage(DealStage.SURVEYED_COMPLETE_NEEDS_SIGN_OFF) + + all_deals = [] + + for deal in deals: + all_deals.append({ + "HUBSPOT_WORK_TYPE": deal.work_type, + "HUBSPOT_DEAL_ADDRESS": deal.deal_name, + "HUBSPOT_TRICKLE_VENT":1 if deal.needs_trickle_ventilation else 0, + "HUBSPOT_WALL_INSULATION": deal.existing_wall_insulation, + "HUBSPOT_POST_INSTALL_SAP_SCORE": deal.post_sap_score, + "HUBSPOT_INSTALLER": deal.installer + }) + + self.all_hubspot_submissions = pd.DataFrame(all_deals) + return self.all_hubspot_submissions + + # TODO diff --git a/etl/tests/test_survey_price.py b/etl/tests/test_survey_price.py index 122ac48..1dc7cad 100644 --- a/etl/tests/test_survey_price.py +++ b/etl/tests/test_survey_price.py @@ -34,3 +34,4 @@ def test_get_price_matrix_jjc_foam(sp): +