From 02a0597e39ed337ba4dc0cccddebb4c98c63b5ee Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Sun, 3 Oct 2010 21:28:23 -0400 Subject: timb: better hiscore code --- src/site.clj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/site.clj') diff --git a/src/site.clj b/src/site.clj index c9b484b..98fde79 100644 --- a/src/site.clj +++ b/src/site.clj @@ -853,7 +853,7 @@ WHERE u.user_id = ANY(?)" (defn redis-ids-test [period] (let [reddis-server {:host "127.0.0.1" :port 6379 :db 0} ids (redis/with-server reddis-server - (redis/zrevrange (str "hiscore." period) 0 20)) + (redis/zrevrange (str "hiscore:" period) 0 -1)) ids (map maybe-parse-int ids)] ids)) @@ -872,6 +872,9 @@ WHERE u.user_id = ANY(?)" ;; Altars +;; if :nick is in params, will fetch only altars by that nick +;; next page links look like /altars/message-id and select <= message_id order desc +;; prev page links look like /altars/-message-id and select > message_id order asc (defn altar-log [session params] (let [id (params :id) nick (params :nick) @@ -1328,6 +1331,8 @@ WHERE u.user_id = ANY(?)" ;; testing (GET "/test/hiscores" (hiscore-test session params "week")) + (GET "/test/hiscores/alltime" (hiscore-test session params "all")) + (GET "/test/hiscores/day" (hiscore-test session params "day")) (GET "/test/hiscores/week" (hiscore-test session params "week")) (GET "/test/hiscores/month" (hiscore-test session params "month")) -- cgit v1.2.3-70-g09d2