From 8af2fe75a6af329e9282664339bc7feec6f82e04 Mon Sep 17 00:00:00 2001 From: Christoph Gasser Date: Tue, 9 Jun 2026 16:15:56 +0200 Subject: [PATCH] Fix M365 summary: per-product totals row and QWE Client-based missing assignments - Total row now sums each license column individually instead of using colspan - Missing Assignment warning now flags licensed users with no QWE Client set, replacing the previous department-based company check Co-Authored-By: Claude Sonnet 4.6 --- app/m365.py | 2 +- app/templates/m365_license.html | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/m365.py b/app/m365.py index 9e76197..9bfc864 100644 --- a/app/m365.py +++ b/app/m365.py @@ -110,7 +110,7 @@ def _apply_overrides(users: list[dict], db: Session) -> list[dict]: def _calculate_summary(users: list[dict]) -> dict: licensed = [u for u in users if u["is_licensed"]] - missing = [u for u in licensed if not u["company"]] + missing = [u for u in licensed if not u["qwe_client"].strip()] # Per-QWE-Client breakdown (primary goal) client_groups: dict[str, list] = defaultdict(list) diff --git a/app/templates/m365_license.html b/app/templates/m365_license.html index 486cb4c..d2b85fa 100644 --- a/app/templates/m365_license.html +++ b/app/templates/m365_license.html @@ -177,7 +177,7 @@
- Missing Company Assignments ({{ summary.missing | length }}) — licensed users not in QWE AT / QWE SK / KFC AT / KFC SK / QWE + Missing QWE Client Assignment ({{ summary.missing | length }}) — licensed users without a QWE Client set
    {% for u in summary.missing %} @@ -362,11 +362,18 @@ return; } - let grandCost = 0, grandUsers = 0; + let grandCost = 0, grandUsers = 0, + grandStd = 0, grandBasic = 0, grandDef = 0, grandPbiPro = 0, grandPbiPrem = 0; + const rowHtml = rows.map(r => { const cost = rowCost(r); - grandCost += cost; - grandUsers += r.count; + grandCost += cost; + grandUsers += r.count; + grandStd += r.m365_standard; + grandBasic += r.m365_basic; + grandDef += r.defender_p1; + grandPbiPro += r.pbi_pro; + grandPbiPrem += r.pbi_premium; return ` ${escHtml(r.name)} @@ -384,7 +391,11 @@ Total ${grandUsers} - + ${fmt(grandStd)} + ${fmt(grandBasic)} + ${fmt(grandDef)} + ${fmt(grandPbiPro)} + ${fmt(grandPbiPrem)} ${fmtEur(grandCost)} `;