[openstreetmap/openstreetmap-website] Add UserActivities module for structured user activity history (PR #5761)
Emin Kocan
notifications at github.com
Mon Mar 24 14:02:24 UTC 2025
@kcne commented on this pull request.
> + # Common SQL for activity days
+ private_class_method def self.activity_days_sql(_user_id)
+ <<~SQL.squish
+ SELECT DATE_TRUNC('day', changesets.created_at) AS day FROM changesets WHERE user_id = :user_id
+ UNION ALL
+ SELECT DATE_TRUNC('day', diary_entries.created_at) AS day FROM diary_entries WHERE user_id = :user_id AND visible = true
+ UNION ALL
+ SELECT DATE_TRUNC('day', changeset_comments.created_at) AS day FROM changeset_comments WHERE author_id = :user_id
+ UNION ALL
+ SELECT DATE_TRUNC('day', note_comments.created_at) AS day FROM note_comments WHERE author_id = :user_id
+ UNION ALL
+ SELECT DATE_TRUNC('day', diary_comments.created_at) AS day FROM diary_comments WHERE user_id = :user_id AND visible = true
+ UNION ALL
+ SELECT DATE_TRUNC('day', gpx_files.timestamp) AS day FROM gpx_files WHERE user_id = :user_id
+ SQL
+ end
Thank you for the time spent on this Tom. I refactored to use the limits as suggested. Also opted for cursor based pagination to support `load more` functionality later. It should also follow the pattern and use the indexes efficitently.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5761#discussion_r2010247893
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5761/review/2710506420 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250324/04a71996/attachment.htm>
More information about the rails-dev
mailing list