Skip to content

feat(api): scope-aware SQL totals for the History summary cards #675

Closed

Description

@cristim

Summary

Follow-up to #632. Summary cards and counts on the History view are computed from the capped, filtered slice, so they under-report once a cap is hit.

Current behaviour

summarizePurchaseHistory (internal/api/handler_history.go) sums over the rows already fetched (at most limit per source). With more rows than the cap the totals are wrong, and #630 only flags truncated.

Steps to verify the gap

More than 100 rows in range: card totals differ from a manual sum of all rows.

Expected behaviour

Totals and counts computed over ALL rows matching the filters, carrying the SAME scope predicate as the row fetch (otherwise they leak cross-tenant counts).

Proposed fix

References

Parent #632, umbrella #248, #630. Severity: medium. Depends on #632 PR2 (scope predicate).

Activity

  1. IAmJSD commented on Oct 20, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  2. self-assigned this
    on Oct 20, 2026
  3. added a commit that references this issue on Oct 25, 2026
    503eb2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions