summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/site.clj6
-rwxr-xr-xsrc/utils.clj11
2 files changed, 14 insertions, 3 deletions
diff --git a/src/site.clj b/src/site.clj
index a5b87d3..31327b2 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -432,10 +432,10 @@ FROM users u
(.setAttribute st "dumps" dumps))
(if (> (count raw-dumps) *dumps-per-page*)
(.setAttribute st "next" (inc offset)))
- (.setAttribute st "score" score)
+ (.setAttribute st "score" (comma-format score))
(.setAttribute st "score_ent" (score-to-entity score))
- (.setAttribute st "dump_cnt" dump-cnt)
- (.setAttribute st "dumps_user_faved_cnt" fav-from-cnt)
+ (.setAttribute st "dump_cnt" (comma-format dump-cnt))
+ (.setAttribute st "dumps_user_faved_cnt" (comma-format fav-from-cnt))
(if (not= offset 0)
(.setAttribute st "prev" (max (dec offset) 0)))
(.setAttribute st "debug_log_items" (logger))
diff --git a/src/utils.clj b/src/utils.clj
index 779bb7b..8bd8291 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -108,6 +108,17 @@
;; Formatters
+(defn- comma-helper [s]
+ (let [f (take 3 s)
+ r (drop 3 s)]
+ (if (= (count r) 0)
+ f
+ (append (comma-helper r) [\,] (reverse f)))))
+
+(defn comma-format [i]
+ (apply str
+ (reverse (comma-helper (reverse (str i))))))
+
(def yyyy-mm-dd-formatter (new SimpleDateFormat "yyyy-MM-dd"))
(defn format-yyyy-mm-dd [d]