هل تتعقب Discourse الأيام المتتالية النشطة؟

A member of our Discourse forum has asked if Discourse has a way to show/recognize consecutive days visiting in or posting in a Discourse forum. I don’t see that information anywhere in the admin’s user information, is it kept anywhere?

FWIW, reddit has this feature.

إعجاب واحد (1)

Well, yes, as there are badges like Enthusiast, Aficionado, and Devotee that are for consecutive days visited. Visited = liked a post/replied once IIRC.

3 إعجابات

You can probably make a data explorer query. here is the user_visits table schema here:

maybe something like this? :thinking:

WITH consecutive_visits AS (
    SELECT
        user_id,
        visited_at,
        visited_at - INTERVAL '1 day' * ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY visited_at) AS grp
    FROM
        user_visits
),
visit_streaks AS (
    SELECT
        user_id,
        COUNT(*) AS streak_length
    FROM
        consecutive_visits
    GROUP BY
        user_id, grp
)
SELECT
    user_id,
    MAX(streak_length) AS longest_streak
FROM
    visit_streaks
GROUP BY
    user_id
ORDER BY
    longest_streak DESC
LIMIT 100

or perhaps you could combine with the user_actions table instead (visits with likes and posts?), which is here:

3 إعجابات

Thanks, I’ll keep that in mind.

إعجاب واحد (1)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.