diff options
| author | Scott Ostler <sbsotler@gmail.com> | 2010-11-23 01:40:43 -0500 |
|---|---|---|
| committer | Scott Ostler <sbsotler@gmail.com> | 2010-11-23 01:40:43 -0500 |
| commit | ad83cbd56471a628cf4cd657bdea962f4f323973 (patch) | |
| tree | 3a995e2674e5ad9e35db2b2c27a5287cf821a680 /src/redisload.clj | |
| parent | 85e6d3994f7d547fe525fb60cb8fcc0f96066c02 (diff) | |
Count txt messages for favscore
Diffstat (limited to 'src/redisload.clj')
| -rw-r--r-- | src/redisload.clj | 20 |
1 files changed, 10 insertions, 10 deletions
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))))))) |
