Skip to content

fix(compliance-report): one table per eForm under a report headline; render checkbox and date answers (#1276) - #1277

Merged
renemadsen merged 2 commits into
stablefrom
fix/1276-rapport-table-per-eform
Sep 15, 2026
Merged

renemadsen merged 2 commits into
stablefrom
fix/1276-rapport-table-per-eform

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Closes #1276

Problem (customer bug list, Rapport view)

eForms merges sammen når samme rapportoverskrift bruges — Checked skal udskiftes med et flueben. Og unchecked skal ikke vises.

  • Two eForms under one report headline rendered as one table with the union of both schemas (duplicate Kommentar / Udført dato columns, blank cells for the other eForm). Reproduced on a customer tenant: 12 of 15 headline groups mixed 2–3 eForms.
  • Checkbox answers printed checked / unchecked; eForm Date answers printed raw ISO (2025-12-01) next to the formatted 01.12.2025.

Root cause

Fix

  • API (compliance-report/eform-columns): ComplianceReportHeadlineGroupModel keeps headlineTagId / headlineName / tagsCaption and replaces checkListIds / schemaUnavailableCheckListIds / columns / cases with templates[] = ComplianceReportTemplateTableModel { checkListId, checkListName, schemaUnavailable, columns, cases }, one per eForm, ordered by name. Group order, fallback group and caption unchanged.
  • View: caption + headline once per section, then one table per eForm under its name. CheckBox: check icon (checked), empty (unchecked), en dash (unanswered). Date answers dd.MM.yyyy.
  • Export: Word/PDF — headings once per headline, eForm name above each table (keep-with-next), ✔ (U+2714, as the legacy report) / empty, Danish dates. CSV — still one flat table (by design), x / blank, ISO dates; rows now come grouped eForm by eForm under a headline instead of interleaved by date.
  • Removes the unused Columns unavailable for template #{{id}} i18n key (26 locales).

Tests

  • Integration: the three tests that pinned the union rewritten to one-table-per-eForm; new tests for per-table columns/cases, no shared column lists, SchemaUnavailable on one template's table only, typed CheckBox/Date export cells, trimming, Word heading/keepNext order, CSV snapshot. The EformColumns_CheckBox_* tests (canonical token) are unchanged.
  • Jest: sections/view specs rewritten for section-per-headline / table-per-eForm, unique keys, per-table row cap and page budget, CheckBox/Date cell rendering.
  • Playwright (s/compliance-report-view.spec.ts): stubbed eform-columns response (CI cannot produce device-channel answers) — one headline over two eForm tables, the tick instead of text, formatted dates.

Verified locally: dotnet build (0 errors), tsc app + spec (no compliance errors), ng build --configuration development. Tests run in CI.

🤖 Generated with Claude Code

…render checkbox and date answers (#1276)

The Rapport view grouped by report headline (#1188) and, as #1188's own
design choice, rendered ONE table per headline with the union of every
eForm's columns: two eForms under one "Rapportoverskrift" merged into a
table with both schemas side by side (duplicate "Kommentar" / "Udført
dato" columns, blank cells for the other eForm). Checkbox answers printed
the canonical token "checked" / "unchecked", and eForm Date answers raw
ISO next to the formatted fixed date column.

- EformColumns: each headline group now carries Templates[] — one table
  per eForm (CheckListId, CheckListName, SchemaUnavailable, its own fresh
  Columns and Cases), ordered by eForm name. Headline grouping, tags
  caption and group order are unchanged.
- View: the caption + headline once per section, then one table per eForm
  under its name (h{headline}-c{checkListId} keys). CheckBox: a check icon
  for checked, empty for unchecked, the en dash when unanswered. Date
  answers as dd.MM.yyyy.
- Export mirrors it: Word/PDF headings once per headline, the eForm name
  above each table (kept with its table), ✔ / empty for checkboxes, Danish
  dates; CSV keeps its single flat table, "x" / blank, ISO dates.
- Removes the now-unused "Columns unavailable for template" i18n key.

Closes #1276

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Add UI_TIMEOUT to the new Playwright expectations before approval.

Pull request overview

Updates compliance reports to render one table per eForm under each report headline, with formatted checkbox and date answers across the UI and exports.

Changes:

  • Refactors report grouping into headline → eForm tables.
  • Adds typed checkbox/date rendering for screen, Word/PDF, and CSV outputs.
  • Updates models, localization, styling, and automated test coverage.
File summaries
File Summary
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceReportService/IBackendConfigurationComplianceReportService.cs Updates service contract documentation.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceReportService/ComplianceReportEformProjector.cs Projects canonical checkbox and date values.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceReportService/BackendConfigurationComplianceReportService.cs Groups cases into per-eForm tables.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceExportService/ComplianceExportWordWriter.cs Renders typed Word/PDF cells and headings.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceExportService/ComplianceExportDocumentBuilder.cs Builds per-eForm export tables.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationComplianceExportService/ComplianceExportCsvWriter.cs Renders typed CSV values.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/ComplianceReport/ComplianceReportTemplateTableModel.cs Adds the per-eForm table model.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/ComplianceReport/ComplianceReportHeadlineGroupModel.cs Models headline groups containing template tables.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/ComplianceReport/ComplianceReportColumnModel.cs Carries column field-type metadata.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/ComplianceReport/ComplianceReportCaseModel.cs Carries per-case template and answer data.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/ComplianceReport/ComplianceExportDocument.cs Adds typed export cell support.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Controllers/ComplianceReportController.cs Documents the updated report endpoint shape.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/ComplianceExportWriterTests.cs Tests export output.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/ComplianceExportImageEmbeddingTests.cs Covers export image embedding behavior.
eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/ComplianceExportDocumentBuilderTests.cs Tests export document construction.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/helpers/compliance-report-sections.ts Maps headline/template sections and formats answers.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/helpers/compliance-report-sections.spec.ts Tests section mapping and answer formatting.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/components/compliance-report-view/compliance-report-view.component.ts Builds per-table grids and typed rendering.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/components/compliance-report-view/compliance-report-view.component.spec.ts Tests table rendering and budgets.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/components/compliance-report-view/compliance-report-view.component.scss Styles table headings and typed cells.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/components/compliance-report-view/compliance-report-view.component.html Renders headline and eForm table structure.
eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance-report/compliance-report.module.ts Updates module integration.
eform-client/src/app/plugins/modules/backend-configuration-pn/models/compliance-report/compliance-report.model.ts Updates frontend report models.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ukUA.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/svSE.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/slSL.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/skSK.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/roRO.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ptPT.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ptBR.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/plPL.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/noNO.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/nlNL.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/lvLV.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ltLT.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/itIT.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/isIS.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/huHU.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/hrHR.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/frFR.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/fiFI.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/etET.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/esES.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/enUS.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/elGR.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/deDE.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/da.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/csCZ.ts Removes the obsolete report translation key.
eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/bgBG.ts Removes the obsolete report translation key.
eform-client/playwright/e2e/plugins/backend-configuration-pn/s/compliance-report-view.spec.ts Adds browser coverage for layout and typed values; new assertions should use UI_TIMEOUT.
eform-client/playwright/e2e/plugins/backend-configuration-pn/s/compliance-page-shell.spec.ts Updates the mocked report response shape.
Review details

Suppressed comments (1)

eform-client/playwright/e2e/plugins/backend-configuration-pn/s/compliance-report-view.spec.ts:287

  • These new assertions omit an explicit timeout, so a missing or malformed mocked response/render can inherit the full test timeout and make this serial shard hang for minutes. Add the shared UI_TIMEOUT to each expectation in this block (and the other newly added expectations in this test) so failures identify the UI condition promptly.
    await expect(section.locator('.compliance-report__tag')).toHaveText(/^\s*Miljøtilsyn\s*$/);
    await expect(section.locator('.compliance-report__heading')).toHaveCount(1);
    await expect(section.locator('.compliance-report__heading')).toHaveText(
      /^\s*Headline 1\s*$/,
    );
  • Files reviewed: 52/52 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…erive (#1276)

Core.Advanced_TemplateFieldReadAll catches every exception itself, logs it
and returns null (SDK Core.cs:4650-4654). The projector folded that null
into an empty field list (`?? []`), so its catch — the only place that set
TemplateSchema.SchemaUnavailable — was unreachable: a template whose schema
could not be read (e.g. a child checklist with no translation in the user's
language) rendered as a table with no answer columns and no notice.

A null return is now treated exactly like a throw: warning logged (with the
exception when Core rethrows), empty columns, SchemaUnavailable = true.
Found by the new EformColumns_UnderivableSchema_IsFlaggedOnThatTemplatesTableOnly
test, which failed in CI on the first push of this PR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 15, 2026 15:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review details
  • Files reviewed: 52/52 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@renemadsen
renemadsen merged commit e44ee87 into stable Sep 15, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants