assert that keys from enrichment process are present
This commit is contained in:
parent
21da4fb3b4
commit
498f80c24a
|
@ -106,6 +106,11 @@
|
||||||
(log/info "Updating changed title for issue" (:id gh-issue))
|
(log/info "Updating changed title for issue" (:id gh-issue))
|
||||||
(issues/update-issue-title (:id gh-issue) (:title gh-issue)))))))
|
(issues/update-issue-title (:id gh-issue) (:title gh-issue)))))))
|
||||||
|
|
||||||
|
(defn assert-keys [m ks]
|
||||||
|
(doseq [k ks]
|
||||||
|
(when-not (find m k)
|
||||||
|
(throw (ex-info (format "Expected key missing from provided map: %s" k) {:map m})))))
|
||||||
|
|
||||||
(defn bounty-state
|
(defn bounty-state
|
||||||
"Given a map as returned by `owner-bounties` return the state the provided bounty is in.
|
"Given a map as returned by `owner-bounties` return the state the provided bounty is in.
|
||||||
|
|
||||||
|
@ -117,6 +122,8 @@
|
||||||
- :pending-contributor-address
|
- :pending-contributor-address
|
||||||
- :pending-maintainer-confirmation"
|
- :pending-maintainer-confirmation"
|
||||||
[bounty]
|
[bounty]
|
||||||
|
(assert-keys bounty [:winner_login :payout_address :confirm_hash :payout_hash
|
||||||
|
:claims :tokens :contract_address])
|
||||||
(if-let [merged? (:winner_login bounty)]
|
(if-let [merged? (:winner_login bounty)]
|
||||||
(cond
|
(cond
|
||||||
(nil? (:payout_address bounty)) :pending-contributor-address
|
(nil? (:payout_address bounty)) :pending-contributor-address
|
||||||
|
@ -124,10 +131,10 @@
|
||||||
(:payout_hash bounty) :paid
|
(:payout_hash bounty) :paid
|
||||||
:else :merged)
|
:else :merged)
|
||||||
(cond ; not yet merged
|
(cond ; not yet merged
|
||||||
(some-> (:claim_count bounty) (< 1)) :multiple-claims
|
(< 1 (count (:claims bounty))) :multiple-claims
|
||||||
(= 1 (:claim_count bounty)) :claimed
|
(= 1 (count (:claims bounty))) :claimed
|
||||||
(seq (:tokens bounty)) :funded
|
(seq (:tokens bounty)) :funded
|
||||||
(:contract_address bounty) :opened)))
|
(:contract_address bounty) :opened)))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(def user 97496)
|
(def user 97496)
|
||||||
|
|
Loading…
Reference in New Issue