Topics Voted On
Returns the topic(s) and creation date of current and archived votes for a given user
-- [params]
-- user_id :user
SELECT tvv.topic_id,
tvv.created_at::date AS "Voted On",
CASE WHEN tvv.archive = TRUE THEN 'Archived' ELSE 'Current' END AS "Current?"
FROM topic_voting_votes tvv
WHERE tvv.user_id = :user
ORDER BY tvv.archive, tvv.created_at