# Consent figures

**Summary:** Consents shows saved counts of accepted or withdrawn consent records, rather than changes made during a period.

- Role: [Technical Support](https://www.subrite.no/technical-support)
- Source: https://www.subrite.no/technical-support/insights-consents
- Updated: 2026-09-28
- Markdown index: https://www.subrite.no/technical-support/llms.txt

Each period uses the latest saved snapshot per consent type.

<a id="what-is-counted"></a>
## What is counted

`processAndSaveConsentActivitySummary` counts nondeleted `MemberConsent` rows joined to the tenant's consent records. It stores `totalAccepted` and `totalWithdrawn` per consent.

The totals query has no member activity, subscription or payment filter. One member can hold several consents, so summing consent counts is not a unique-member total.

**Withdrawn** counts rows with that status. It excludes people who never had a consent record and rows with another status. [Source: totals collection](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/services/stats-store.service.ts#L817-L895).

For example, one member accepting 2 consent types contributes 1 to each type and 2 to their combined count.

<a id="snapshot-time-and-active-consent-filtering"></a>
## Snapshot time and active-consent filtering

The historical query selects `MAX(createdAt)` per consent and period, within the requested date window. It sums `totalAccepted` or `totalWithdrawn` from matching rows. The graph uses summary creation time, not `dateOfRecord`.

The writer's totals query reads current rows without a historical cutoff. Supplying an older `dataDate` does not reconstruct old consent totals; it changes the reporting date and daily-change window.

Only currently active consent IDs are queried. Deactivating a consent type removes its historical series from this report. If no active consent IDs exist, the repository returns an empty result. [Source: snapshot query and empty guard](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/repositories/consent-activity-summary.repository.ts#L98-L185).

A saved summary for the same tenant and `dateOfRecord` makes the collector return early. A rerun is therefore not evidence that newer rows were recounted. [Source: collection guard](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/services/stats-store.service.ts#L779-L795).

<a id="why-historical-groups-or-totals-disappear"></a>
## Why historical groups or totals disappear

The service passes `noOfLine - 1` as the named-group limit. View 5 selects 4 named consents; All selects at most 99.

`formatHistoricalData` ranks groups by count in the latest returned period. It adds Others only when that period contains more groups than the named-group limit.

When Others exists, it collects each period's nonselected groups. When it does not exist, older groups outside the latest selection are omitted. Switching to **Total** cannot recover omitted groups because it sums only returned datasets. [Sources: group limit](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/services/stats.services.ts#L622-L640), [ranking and Others](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/services/stats.services.ts#L818-L894).

<a id="time-window-and-display"></a>
## Time window and display

Defaults are accepted status, weekly periods and view 5. The weekly default covers the last 12 weeks. Daily windows end yesterday; coarser windows include the current unfinished period. Explicit windows and All time are capped at 550 buckets. [Source: timeline bounds](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/frontend/src/app/%28admin%29/admin/%28panel%29/analytics/statistics/utils/timeline/resolveTimelineWindow.ts#L53-L185).

The chart converts zero values to `null`. Missing or malformed responses render an empty graph. Check the response before interpreting a blank graph as a zero count. [Source: chart mapping](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/frontend/src/app/%28admin%29/admin/%28panel%29/analytics/statistics/consents/ConsentStats/index.tsx#L30-L80).

Tooltip percentages divide a visible consent count by all visible counts. They are shares of returned records, not acceptance rates. Total includes hidden returned series; shared positional legend state can still hide the combined bar. [Source: chart arithmetic](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/frontend/src/ui/StatsView/index.tsx#L182-L246).

<a id="diagnose-a-discrepancy"></a>
## Diagnose a discrepancy

- Total exceeds member count: check how many consent types each member contributes to; there is no cross-consent deduplication.
- Old consent missing: check its current active status, latest-period ranking and whether Others exists.
- Daily count differs from Consent changes: compare snapshot `createdAt` with activity `dateOfRecord`, then compare current statuses with updated records.
- Recent edits missing: inspect the latest snapshot time and the existing-row collection guard.
- Blank Total after hiding a series: restore all legend series; hiding affects display separately from aggregation.

The `historical-consent-summary` endpoint requires Dashboard read permission. The menu also requires Analytics access and Insights. [Source: endpoint gate](https://github.com/subrite/subrite-crm/blob/6cd1850569be3b1702ca736a19320c7626efb7bc/api-server/src/modules/stats/controllers/stats.controller.ts#L383-L393).

<a id="sources-and-verification"></a>
## Sources and verification

Source checked 28 September 2026 at `6cd1850569be3b1702ca736a19320c7626efb7bc`. Existing UI evidence confirms report navigation. No fresh UI, numeric reconciliation, refresh-time or ordinary-role test was performed.

For graph interpretation and controls, see [Consent figures](https://www.subrite.no/administrators/insights-consents?md=true).

## Related pages

- [Consent figures](https://www.subrite.no/administrators/insights-consents?md=true): Consents shows saved counts of accepted or withdrawn consent records, rather than changes made during a period.
