diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-06-23 06:05:18 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-06-23 06:05:18 -0400 |
| commit | a0ff1251ce9fc1452fcd8c92737897f414f365c0 (patch) | |
| tree | f926fa9c0cc1819f198b24cf856ee5ceb11b6e16 /src/fame.clj | |
| parent | e1d45671c8895f3065a166de3ec40c92dd20781f (diff) | |
Added hall of fame
Diffstat (limited to 'src/fame.clj')
| -rw-r--r-- | src/fame.clj | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/fame.clj b/src/fame.clj new file mode 100644 index 0000000..8f0ae4f --- /dev/null +++ b/src/fame.clj @@ -0,0 +1,27 @@ +(ns fame + (:use scheduled-agent + utils)) + +; should probably cache this to disk somewhere +(def hall-of-fame-update-frequency (* 4 60 60)) + +(def hall-of-fame-query " +select m.created_on, m.message_id, m.content, u.nick, u.avatar, r.key, count(*) +from tags t, messages m, rooms r, users u +where t.message_id = m.message_id +and m.user_id = u.user_id +and m.room_id = r.room_id +and r.admin_only = false +group by m.created_on, m.message_id, m.content, u.nick, u.avatar, r.key +order by count(*) desc +limit 50 +") + +(defn fetch-hall-of-fame [] + (do-select [hall-of-fame-query])) + + +(def hall-results (scheduled-agent fetch-hall-of-fame + hall-of-fame-update-frequency + nil)) +
\ No newline at end of file |
