Fix portfolio change to 0 if balance is zero
If you don't have money in your balance, your "portfolio" change is nothing. - Positive portfolio change includes if it is zero
This commit is contained in:
parent
e8c2fa1f80
commit
c846574155
|
@ -45,7 +45,7 @@
|
|||
transaction-history-action]]])
|
||||
|
||||
(defn- change-display [change]
|
||||
(let [pos-change? (pos? change)]
|
||||
(let [pos-change? (or (pos? change) (zero? change))]
|
||||
[react/view {:style (if pos-change?
|
||||
wallet.styles/today-variation-container-positive
|
||||
wallet.styles/today-variation-container-negative)}
|
||||
|
|
|
@ -46,11 +46,14 @@
|
|||
(reg-sub :portfolio-change
|
||||
:<- [:price]
|
||||
:<- [:last-day]
|
||||
(fn [[price last-day]]
|
||||
:<- [:balance]
|
||||
(fn [[price last-day balance]]
|
||||
(when (and price last-day)
|
||||
(if (> balance 0)
|
||||
(-> (money/percent-change price last-day)
|
||||
(money/with-precision 2)
|
||||
.toNumber))))
|
||||
.toNumber)
|
||||
0))))
|
||||
|
||||
(reg-sub :prices-loading?
|
||||
(fn [db]
|
||||
|
|
Loading…
Reference in New Issue