From 516a3ed549a0e5c985edc2f6ca910c6c06754074 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 1 Dec 2025 21:38:41 +0000 Subject: [PATCH] upload this to main --- backend/src/dashboard/main.py | 26 +++---------------- backend/src/dashboard/services/json_reader.py | 7 +++-- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/backend/src/dashboard/main.py b/backend/src/dashboard/main.py index a4336ee..bc6e8f7 100644 --- a/backend/src/dashboard/main.py +++ b/backend/src/dashboard/main.py @@ -24,26 +24,6 @@ def current_week_start(): monday = today - timedelta(days=today.weekday()) return monday.strftime("%Y-%m-%d") - -# ----------------------------------------------------- -# Product Types -# ----------------------------------------------------- -PRODUCT_TYPES = [ - ### ECO THINGS - "Empty Cavity - ECO4", - "Solar PV - ECO4", "Extract & Fill - ECO4", - "Solar PV + Heating Upgrade - ECO4", "Solar PV + HHRSH - ECO4", - "ECO4 empty cavity survey", "ECO4 Retrofit Coordination", - "ECO4 Solar with client contribution", "EPC", - ### WARM HOMES THINGS - "Design Archetype Complex", "Coordination Stage 1", "Full Lodgement Phase 2", - "Retrofit Assessment","Post EPC NO SHOW", "ATT NO SHOW", "RA NO SHOW", "Post ATT", "Post EPC", "Post EPR", "Lodgement Phase 1", - "Coordination Stage 2", "Design Repetitive Complex", "Design Repetitive Simple", "Air Tightness Test", "Design Archetype Simple", - # Other - "Boroscope Survey", -] - - # ----------------------------------------------------- # Load & Build Master DF # ----------------------------------------------------- @@ -54,7 +34,7 @@ def build_master_df(): frames = [] - for p in PRODUCT_TYPES: + for p in hubspot_data.line_item_names: df = hubspot_data.generate_df_via_product_type(p) if df is None or df.empty: continue @@ -291,8 +271,8 @@ def open_modal(jobs_cell, revenue_cell, close_click, jobs_data, revenue_data, is return html.P("No IDs recorded for this cell.") ids = raw_ids.split(SAFE_DELIM) - - return html.Ul([id_to_link(d) for d in ids]) + seen = set() + return html.Ul([id_to_link(d) for d in ids if not (d in seen or seen.add(d))]) # ------------------------- # JOBS TABLE CLICK diff --git a/backend/src/dashboard/services/json_reader.py b/backend/src/dashboard/services/json_reader.py index 6474fbe..9eb1539 100644 --- a/backend/src/dashboard/services/json_reader.py +++ b/backend/src/dashboard/services/json_reader.py @@ -60,7 +60,7 @@ class jsonReader: def _return_df_from_deal_info(self, deal, product_type): rows = [] - if "ECO" in product_type or "EPC" in product_type: + if deal["company_info"]["name"] != "Apple": if deal["attempts"]: # Multiple attempts => multiple rows for attempt in deal["attempts"]: @@ -74,6 +74,7 @@ class jsonReader: None ), "deal_name": deal["deal_properties"]["dealname"], + "company_name": deal["company_info"]["name"], }) else: def historical_ecd_value_processes(timestamp): @@ -121,6 +122,7 @@ class jsonReader: None ), "deal_name": deal["deal_properties"]["dealname"], + "company_name": deal["company_info"]["name"], }) # 2️⃣ Add the remaining history WITHOUT submission date @@ -135,11 +137,12 @@ class jsonReader: None ), "deal_name": deal["deal_properties"]["dealname"], + "company_name": deal["company_info"]["name"], }) # Return a DataFrame or None return pd.DataFrame(rows) if rows else None - + def find_all_job_with_line_item(self): for i, deal in enumerate(self.raw_data): if len(deal["line_items"])>0: