better logging around payout receipt interceptor

This commit is contained in:
Rob Culliton 2018-05-08 14:34:01 -04:00
parent 08d56400ad
commit c57a6a1a63
No known key found for this signature in database
GPG Key ID: 6FDEF60B3DC84D94
2 changed files with 11 additions and 5 deletions

View File

@ -222,7 +222,8 @@
(reg-event-db
:set-owner-bounties
;; [commiteth.interceptors/confirm-hash-update]
[commiteth.interceptors/watch-confirm-hash
commiteth.interceptors/watch-payout-receipt]
(fn [db [_ issues]]
(assoc db
:owner-bounties issues
@ -420,6 +421,7 @@
(reg-event-fx
:remove-pending-revocation
interceptors
(fn [{:keys [db]} [_ issue-id]]
{:db (update db ::db/pending-revocations #(disj % issue-id))}))

View File

@ -9,12 +9,14 @@
vals
(->> (map #(field-name %)))))
(defn filter-updated-bounties [field-name new-bounties old-bounties]
(defn filter-updated-bounties [field-name old-bounties new-bounties]
"filters collection of bounties to only those with a field that has been recently set"
(filter (fn [[issue-id owner-bounty]]
(let [new-confirm-hash (field-name owner-bounty)
old-confirm-hash (get-in old-bounties [issue-id field-name])]
(and (nil? old-confirm-hash) (some? new-confirm-hash))))
(let [new-field-value (field-name owner-bounty)
old-field-value (get-in old-bounties [issue-id field-name])]
(println "old value for " field-name " is " old-field-value)
(println "new value for " field-name "is " new-field-value)
(and (nil? old-field-value) (some? new-field-value))))
new-bounties))
(defn dispatch-confirm-payout [bounty]
@ -43,6 +45,7 @@
:id :watch-confirm-hash
:after (fn confirm-hash-update-after
[context]
(println "watch confirm hash interceptor...")
(let [event-name (-> context
:coeffects
:event
@ -83,6 +86,7 @@
:id :watch-payout-receipt
:after (fn payout-receipt-update-after
[context]
(println "watch payout receipt interceptor...")
(let [event-name (-> context
:coeffects
:event