Skip to content

Add Project Views metric to sidebar#2556

Merged
lukepayyapilli merged 1 commit intoMIT-LCP:devfrom
lukepayyapilli:feature/project-metrics
Jan 15, 2026
Merged

Add Project Views metric to sidebar#2556
lukepayyapilli merged 1 commit intoMIT-LCP:devfrom
lukepayyapilli:feature/project-metrics

Conversation

@lukepayyapilli
Copy link
Contributor

@lukepayyapilli lukepayyapilli commented Jan 14, 2026

Summary

  • Adds a "Project Views" card to the published project sidebar displaying unique file views count.
  • Counts unique authenticated users who have viewed the project's files section.
  • Includes tests for the new feature.

Part of #2336 (Phase 1a)

Screenshot

Screenshot 2026-01-14 at 5 29 48 PM

Future Optimizations

  • Add composite index on (content_type_id, object_id) to the Log model for faster lookups.
  • Consider denormalizing the count on the project model for high-traffic projects.

Copy link
Member

@tompollard tompollard left a comment

Choose a reason for hiding this comment

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

Thanks Luke! I have added a couple of quick thoughts below:

  • I hadn't realized that these logs only count logged-in users. I think this is okay, but we should make it very clear that this is the case (i.e. somehow explain that we are only counting registered users and that we are significantly undercounting true views).
  • I wonder whether we should aggregate the count for all versions of a project (i.e. if a project has v1 and v2 then we combine the unique counts)? We could consider counting two counts: this version and all versions.
  • Instead of "File views" we should say "Views" or "Project Views" (project is the term we use to describe any published resource).

@lukepayyapilli lukepayyapilli force-pushed the feature/project-metrics branch from eabfe39 to 2a4ae27 Compare January 14, 2026 22:19
@lukepayyapilli lukepayyapilli changed the title Add File Views metric to project sidebar Add Project Views metric to sidebar Jan 14, 2026
@lukepayyapilli lukepayyapilli force-pushed the feature/project-metrics branch from 2a4ae27 to 566bde2 Compare January 14, 2026 22:23
@tompollard
Copy link
Member

Thanks! Instead of "Count of Registered Users", how about "Project Views by Unique Registered Users"?

@lukepayyapilli lukepayyapilli force-pushed the feature/project-metrics branch from 566bde2 to 40a284a Compare January 14, 2026 22:29
@lukepayyapilli
Copy link
Contributor Author

lukepayyapilli commented Jan 14, 2026

Thanks! Instead of "Count of Registered Users", how about "Project Views by Unique Registered Users"?

Done @tompollard!

Copy link
Member

@tompollard tompollard left a comment

Choose a reason for hiding this comment

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

Thanks Luke, looks good to me. We will want to make some tweaks later (not completely happy with "Project Views by Unique Registered Users" and want to check exactly what we capture) but the addition of the number is step forward!

@lukepayyapilli lukepayyapilli added this pull request to the merge queue Jan 15, 2026
Merged via the queue into MIT-LCP:dev with commit e33b743 Jan 15, 2026
7 checks passed
@lukepayyapilli lukepayyapilli deleted the feature/project-metrics branch January 23, 2026 14:50
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

Comments