From 4ba5c37f475faa7ad7c872cfe75355522f6eee5d Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Tue, 12 May 2026 14:53:42 -0400 Subject: [PATCH] Fix WO render_badge None guard, updated_at slice, and backfill path Add null guard to WO render_badge matching the PO version. Use `or ""` before slicing updated_at to handle explicit None values. Fix backfill_sites.py sys.path to use new lambdas/po/site_extractor. --- lambdas/wo/web_ui/handler.py | 4 +++- scripts/backfill_sites.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lambdas/wo/web_ui/handler.py b/lambdas/wo/web_ui/handler.py index 4168942..f8bb0a5 100644 --- a/lambdas/wo/web_ui/handler.py +++ b/lambdas/wo/web_ui/handler.py @@ -40,6 +40,8 @@ def get_comments(work_order_id): def render_badge(value, color_map): + if not value: + value = "unknown" color = color_map.get(value, "#9ca3af") label = esc(value.replace("_", " ").title()) return f'{label}' @@ -163,7 +165,7 @@ def render_work_orders_list(work_orders): status = wo.get("wo_status", "unknown") record_type = wo.get("record_type", "unknown") due = esc(wo.get("due_date", "")) - updated = esc(wo.get("updated_at", "")[:16]) + updated = esc((wo.get("updated_at") or "")[:16]) rows += f"""