summaryrefslogtreecommitdiff
path: root/src/site.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/site.clj')
-rw-r--r--src/site.clj29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/site.clj b/src/site.clj
index c25a18d..c9b484b 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -848,6 +848,28 @@ WHERE u.user_id = ANY(?)"
(log session (lookup-room room-key) offset params)
(resp-error "UNKNOWN_ROOM"))))
+;; Hiscore test... redis test...
+
+(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))
+ ids (map maybe-parse-int ids)]
+ ids))
+
+(defn hiscore-test [session params period]
+ (let [st (fetch-template "hiscore_test" session)
+ dumps (tags/fetch-dumps-by-ids (redis-ids-test period))
+ dumps (map tags/add-favorited-flag dumps (repeat session))
+ dumps (map tags/add-fav-count dumps)
+ dumps (reverse (sort-by :favcount dumps))
+ dumps (map tags/remove-tags-for-output dumps)
+ dumps (map process-message-for-output dumps)]
+ (.setAttribute st "dumps" dumps)
+ (.toString st)))
+
+
+
;; Altars
(defn altar-log [session params]
@@ -1304,6 +1326,13 @@ WHERE u.user_id = ANY(?)"
(altar-log session params)
(redirect-to (str "/" (params :id) "/altars")))) ;; redirect /altars/timb to /timb/altars
+ ;; testing
+ (GET "/test/hiscores" (hiscore-test session params "week"))
+ (GET "/test/hiscores/week" (hiscore-test session params "week"))
+ (GET "/test/hiscores/month" (hiscore-test session params "month"))
+
+
+
;; Events
(GET "/event" (current-event session))