Log issue details along with wrong token balance

This commit is contained in:
Vitaliy Vlasov 2018-03-12 18:21:49 +02:00
parent 34f3913ff4
commit e540bd04ac
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
1 changed files with 30 additions and 22 deletions

View File

@ -146,32 +146,40 @@
(defn prettify-bounty-items [bounty-items] (defn prettify-bounty-items [bounty-items]
(let [format-float (fn [balance] (let [format-float (fn [bounty balance]
(try (try
(format "%.2f" (float balance)) (format "%.2f" (double balance))
(catch Throwable ex (catch Throwable ex
(log/error "Failed to convert token value:" balance) (log/error (str (:repo-owner bounty)
"0.00"))) "/"
renames {:user_name :display-name (:repo-name bounty)
:user_avatar_url :avatar-url "/"
:issue_title :issue-title (:issue-number bounty))
:type :item-type "Failed to convert token value:" balance)
:repo_name :repo-name "0.00")))
:repo_owner :repo-owner update-token-values (fn [bounty]
:issue_number :issue-number (->> bounty
:value_usd :value-usd :tokens
:claim_count :claim-count (map (fn [[tla balance]]
:balance_eth :balance-eth [tla (format-float bounty balance)]))
:user_has_address :user-has-address}] (into {})
(assoc bounty :tokens)))
renames {:user_name :display-name
:user_avatar_url :avatar-url
:issue_title :issue-title
:type :item-type
:repo_name :repo-name
:repo_owner :repo-owner
:issue_number :issue-number
:value_usd :value-usd
:claim_count :claim-count
:balance_eth :balance-eth
:user_has_address :user-has-address}]
(map #(-> % (map #(-> %
(rename-keys renames) (rename-keys renames)
(update :value-usd usd-decimal->str) (update :value-usd usd-decimal->str)
(update :balance-eth eth-decimal->str) (update :balance-eth eth-decimal->str)
(update :tokens (fn [tokens] update-token-values)
(into {}
(map (fn [[tla balance]]
[tla (format-float balance)])
tokens)))))
bounty-items))) bounty-items)))
(defn activity-feed [] (defn activity-feed []