Permalink
Browse files

Merge branch 'hotfix/1.3.1.1'

  • Loading branch information...
2 parents 54b2859 + e15ec09 commit ce2c36d7bcecad0cb15b3c77dc2dcf0dd23916a4 @amalloy amalloy committed Sep 20, 2011
Showing with 12 additions and 12 deletions.
  1. +1 −1 project.clj
  2. +11 −11 src/foreclojure/mongo.clj
View
@@ -1,4 +1,4 @@
-(defproject foreclojure "1.3.1"
+(defproject foreclojure "1.3.1.1"
:description "4clojure - a website for lisp beginners"
:dependencies [[clojure "1.2.1"]
[clojure-contrib "1.2.0"]
@@ -43,17 +43,17 @@
(defn reconcile-solved-count
"Overwrites the times-solved field in the problems collection based on data from the users collection. Should only be called on server startup since it isn't a safe operation. Also updates the total-solved agent."
[]
- (let [+ (fnil + 0)
- [total scores]
- (->> (fetch :users :only [:scores])
- (mapcat :scores)
- (frequencies)
- (reduce (fn [[total scores] [[id score] times]]
- [(+ total times)
- (update-in scores
- [(number-from-mongo-key id) score]
- + times)])
- [0 {}]))]
+ (let [+ (fnil + 0)
+ users (fetch :users :only [:scores :solved])
+ scores (->> users
+ (mapcat :scores)
+ (frequencies)
+ (reduce (fn [scores [[id score] times]]
+ (update-in scores
+ [(number-from-mongo-key id) score]
+ + times))
+ {}))
+ total (count (mapcat :solved users))]
(send solved-stats (constantly (assoc scores :total total)))))
(defn prepare-mongo []

0 comments on commit ce2c36d

Please sign in to comment.