From ad83cbd56471a628cf4cd657bdea962f4f323973 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Tue, 23 Nov 2010 01:40:43 -0500 Subject: Count txt messages for favscore --- src/redisload.clj | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/redisload.clj b/src/redisload.clj index 07c1275..31a25f0 100644 --- a/src/redisload.clj +++ b/src/redisload.clj @@ -49,16 +49,16 @@ WHERE (def score-map (ref {})) (defn update-popular [r] - (if (and (:is_image r) (not (:admin_only r))) - (dosync - (let [author (:author r) - msg-id (:message_id r) - user-map (get @popular-map author {}) - msg-cnt (get user-map msg-id 0) - hall-cnt (get @hall-map msg-id 0) - usr-cnt (get @score-map author 0)] - (alter hall-map assoc msg-id (inc hall-cnt)) - (alter score-map assoc author (inc usr-cnt)) + (dosync + (let [author (:author r) + msg-id (:message_id r) + user-map (get @popular-map author {}) + msg-cnt (get user-map msg-id 0) + hall-cnt (get @hall-map msg-id 0) + usr-cnt (get @score-map author 0)] + (alter score-map assoc author (inc usr-cnt)) + (alter hall-map assoc msg-id (inc hall-cnt)) + (if (:is_image r) (alter popular-map assoc author (assoc user-map msg-id (inc msg-cnt))))))) -- cgit v1.2.3-70-g09d2