See who viewed topic

이 작업을 위한 Data Explorer 쿼리를 가지고 있습니다(사용자 이름, CSV, 그룹, 개인 메시지 관련 항목을 표시합니다):

-- Who viewed this topic? https://meta.discourse.org/t/see-who-viewed-topic/29277/11
-- [params]
-- int :topic_id
SELECT tu.user_id, u.username, total_msecs_viewed/1000 AS seconds_viewed
FROM topic_users tu
JOIN users u ON tu.user_id  = u.id
WHERE tu.topic_id = :topic_id
    AND total_msecs_viewed > 0
GROUP BY tu.user_id, u.username, tu.total_msecs_viewed
ORDER BY tu.total_msecs_viewed desc

컨텍스트상 이메일 주소를 공개하는 것이 괜찮다면, 대신 이 쿼리를建议使用합니다:

-- Who viewed this topic? With emails. https://meta.discourse.org/t/see-who-viewed-topic/29277/11
-- [params]
-- int :topic_id
SELECT tu.user_id, email, total_msecs_viewed/1000 AS seconds_viewed
FROM topic_users tu
JOIN user_emails ue ON tu.user_id  = ue.user_id
WHERE tu.topic_id = :topic_id
    AND total_msecs_viewed > 0
GROUP BY tu.user_id, ue.email, tu.total_msecs_viewed
ORDER BY tu.total_msecs_viewed desc