format prices with 2 decimal places always
This commit is contained in:
parent
ac93a58829
commit
f8d858e821
|
@ -7,7 +7,8 @@
|
|||
[webtools.reagent.components :refer [raw-html]]
|
||||
[mtgcoll.common :refer [max-search-results]]
|
||||
[mtgcoll.client.components.utils :refer [set-short-label symboled-markup th-sortable]]
|
||||
[mtgcoll.client.components.inventory :refer [inventory]]))
|
||||
[mtgcoll.client.components.inventory :refer [inventory]]
|
||||
[mtgcoll.client.utils :refer [format-currency]]))
|
||||
|
||||
(defn card-image
|
||||
[card-id & {:keys [width height]}]
|
||||
|
@ -86,8 +87,8 @@
|
|||
(if (or power toughness)
|
||||
(str " (" power "/" toughness ")")))]
|
||||
[:td rarity]
|
||||
[:td paper_price]
|
||||
[:td online_price]
|
||||
[:td (format-currency paper_price true)]
|
||||
[:td (format-currency online_price true)]
|
||||
[:td [inventory id
|
||||
{:num-owned owned_count
|
||||
:button-size "xsmall"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[mtgcoll.client.components.cards :refer [card-image card-link]]
|
||||
[mtgcoll.client.components.utils :refer [symbol-image set-heading set-label symboled-markup]]
|
||||
[mtgcoll.client.components.inventory :refer [inventory]]
|
||||
[mtgcoll.client.utils :refer [format-date format-datetime]]))
|
||||
[mtgcoll.client.utils :refer [format-date format-datetime format-currency]]))
|
||||
|
||||
(defn detail
|
||||
[& components]
|
||||
|
@ -178,8 +178,8 @@
|
|||
^{:key idx}
|
||||
[:tr
|
||||
[:td source]
|
||||
[:td paper-price]
|
||||
[:td online-price]
|
||||
[:td (format-currency paper-price true)]
|
||||
[:td (format-currency online-price true)]
|
||||
[:td (format-datetime last-updated)]]))))]]])
|
||||
(if (and (seq @printings)
|
||||
(> (count @printings) 1))
|
||||
|
|
|
@ -60,6 +60,6 @@
|
|||
(string/replace (str n) #"\B(?=(\d{3})+(?!\d))" ",")))
|
||||
|
||||
(defn format-currency
|
||||
[n]
|
||||
[n & [number-only?]]
|
||||
(if n
|
||||
(str "$" (pprint/cl-format nil "~,2f" n))))
|
||||
(str (if-not number-only? "$") (pprint/cl-format nil "~,2f" n))))
|
||||
|
|
Loading…
Reference in a new issue