Skip to content

Fix reading stats double-counted if appearing 2+ times on same work#11802

Merged
cdrini merged 1 commit intomasterfrom
11769/fix/duplicate-reading-stats
Feb 3, 2026
Merged

Fix reading stats double-counted if appearing 2+ times on same work#11802
cdrini merged 1 commit intomasterfrom
11769/fix/duplicate-reading-stats

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Feb 3, 2026

Closes #11769

Technical

Testing

Screenshot

Before:
image

After:
image

Stakeholders

@cdrini cdrini marked this pull request as ready for review February 3, 2026 16:18
Copilot AI review requested due to automatic review settings February 3, 2026 16:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes inflated counts on the “My Stats” page when the same work contributes multiple identical keys (e.g., the same author or category appearing more than once on a single work), which previously caused double-counting in the aggregations.

Changes:

  • Deduplicates per-work keys used for grouping/aggregation in createWorkChart by wrapping the filtered key list with uniq(...) so each work contributes at most once per key.
  • Keeps the existing exclusion logic intact while ensuring only unique, valid keys are used when populating the grouped stats data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cdrini
Copy link
Collaborator Author

cdrini commented Feb 3, 2026

Auto-merging ; small one liner fix. Verified working on testing.

@cdrini cdrini merged commit acd58ae into master Feb 3, 2026
14 checks passed
@cdrini cdrini deleted the 11769/fix/duplicate-reading-stats branch February 3, 2026 16:23
bhardwajparth51 added a commit to bhardwajparth51/openlibrary that referenced this pull request Feb 17, 2026
…ix/duplicate-reading-stats

Fix reading stats double-counted if appearing 2+ times on same work
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.

Some (but not all) books are counted twice on My Stats page

2 participants