From c57a6a1a630daaf7bb998aa673f714c75cd18252 Mon Sep 17 00:00:00 2001 From: Rob Culliton Date: Tue, 8 May 2018 14:34:01 -0400 Subject: [PATCH] better logging around payout receipt interceptor --- src/cljs/commiteth/handlers.cljs | 4 +++- src/cljs/commiteth/interceptors.cljs | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cljs/commiteth/handlers.cljs b/src/cljs/commiteth/handlers.cljs index d762791..c105b53 100644 --- a/src/cljs/commiteth/handlers.cljs +++ b/src/cljs/commiteth/handlers.cljs @@ -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))})) diff --git a/src/cljs/commiteth/interceptors.cljs b/src/cljs/commiteth/interceptors.cljs index d20a914..62d74db 100644 --- a/src/cljs/commiteth/interceptors.cljs +++ b/src/cljs/commiteth/interceptors.cljs @@ -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