mirror of
https://github.com/Hestia-Homes/insight.git
synced 2026-06-08 11:17:25 +00:00
Merge pull request #18 from Hestia-Homes/feature/make_it_live_ready
save to main
This commit is contained in:
commit
3c5fffe7ea
1 changed files with 24 additions and 5 deletions
|
|
@ -9,6 +9,9 @@ from backend.src.dashboard.services.file_manager import FileManager
|
|||
from backend.src.dashboard.services.json_reader import jsonReader
|
||||
from backend.src.dashboard.components.pivot_charts import build_pivot_tables_and_charts, week_start_monday
|
||||
|
||||
# from dashboard.services.file_manager import FileManager
|
||||
# from dashboard.services.json_reader import jsonReader
|
||||
# from dashboard.components.pivot_charts import build_pivot_tables_and_charts, week_start_monday
|
||||
|
||||
SAFE_DELIM = "\\\\"
|
||||
|
||||
|
|
@ -257,15 +260,31 @@ def open_modal(jobs_cell, revenue_cell, close_click, jobs_data, revenue_data, is
|
|||
# -------------------------
|
||||
def build_modal(row, col_id):
|
||||
|
||||
if "_" not in col_id:
|
||||
return html.P("No HubSpot IDs for this column.")
|
||||
# Ignore columns like "Product Type"
|
||||
if col_id == "Product Type":
|
||||
return html.P("This column has no IDs.")
|
||||
|
||||
week, side = col_id.split("_", 1)
|
||||
# ----------------------------------------------------
|
||||
# 1. Detect week
|
||||
# ----------------------------------------------------
|
||||
parts = col_id.split(" ")
|
||||
|
||||
side_lower = side.lower()
|
||||
# Revenue columns = 3 parts → ["2025-02-05", "Planned", "£"]
|
||||
# Jobs columns = 2 parts → ["2025-02-05_Planned", "Jobs"]
|
||||
if "_" in parts[0]:
|
||||
# Jobs table format: 2025-02-05_Planned
|
||||
week = parts[0].split("_")[0]
|
||||
else:
|
||||
# Revenue table format: 2025-02-05 Planned £
|
||||
week = parts[0]
|
||||
|
||||
id_key = f"{week}_planned_ids" if "planned" in side_lower else f"{week}_actual_ids"
|
||||
# ----------------------------------------------------
|
||||
# 2. Detect planned vs actual
|
||||
# ----------------------------------------------------
|
||||
label = col_id.lower()
|
||||
is_planned = "planned" in label
|
||||
|
||||
id_key = f"{week}_planned_ids" if is_planned else f"{week}_actual_ids"
|
||||
raw_ids = row.get(id_key, "")
|
||||
|
||||
if not raw_ids:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue