upload this to main

This commit is contained in:
Jun-te Kim 2025-12-01 21:38:41 +00:00
parent cc013be5dd
commit 516a3ed549
2 changed files with 8 additions and 25 deletions

View file

@ -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

View file

@ -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: