Skip to content

fix: Download analytics on collection scope#3597

Merged
isTravis merged 1 commit intomainfrom
tr/collectiondownloadsfix
Apr 21, 2026
Merged

fix: Download analytics on collection scope#3597
isTravis merged 1 commit intomainfrom
tr/collectiondownloadsfix

Conversation

@isTravis
Copy link
Copy Markdown
Member

Download events in AnalyticsEvents only carry pubId and communityId - they never set collectionId. The fetchSummaryFromRaw query in impactApi.ts was filtering all events (including downloads) by "collectionId" = :collectionId, which always matched zero download rows. Fixed by using a CollectionPubs subquery ("pubId" IN (SELECT "pubId" FROM "CollectionPubs" WHERE "collectionId" = :collectionId)) for the two download-related queries (total downloads and per-pub downloads in the top pubs table). Page view queries are unaffected since those events do carry collectionId. The fix applies retroactively to all historical data.

@isTravis isTravis merged commit c697adf into main Apr 21, 2026
1 check passed
@isTravis isTravis deleted the tr/collectiondownloadsfix branch April 21, 2026 14:33
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.

1 participant