Show 2 decimals for tokens on comment image

This commit is contained in:
Teemu Patja 2017-08-24 14:17:37 +03:00
parent a091d04bb2
commit 92b51251c0
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 5 additions and 4 deletions

View File

@ -26,9 +26,10 @@
(defn token-map->list [tokens] (defn token-map->list [tokens]
(mapv (fn [[tla balance]] {:tla (subs (str tla) 1) (let [fmt-balance (fn [x] (format "%.02f" (double x)))]
:balance balance}) (mapv (fn [[tla balance]] {:tla (subs (str tla) 1)
tokens)) :balance (fmt-balance balance)})
tokens)))
(defn image-height [tokens] (defn image-height [tokens]
(+ 300 (* 32 (count (keys tokens))))) (+ 300 (* 32 (count (keys tokens)))))
@ -73,4 +74,4 @@
(comment (comment
(with-open [w (io/output-stream "foo.png")] (with-open [w (io/output-stream "foo.png")]
(.write w (gen-comment-image "0xf00barbeeff00barbeeff00barbeeff00barbeef" "12.2" {:SNT 250 :GNO 100 :WTF 3452.42} "http://github.com/someorg/somerepo/issues/42")))) (.write w (gen-comment-image "0xf00barbeeff00barbeeff00barbeeff00barbeef" "12.2" {:SNT 250.2000000343 :GNO 100 :WTF 3452.42} "http://github.com/someorg/somerepo/issues/42"))))