From f654e0452fbd7e33593560200110208b306eab72 Mon Sep 17 00:00:00 2001 From: Martin Klepsch Date: Wed, 21 Feb 2018 18:36:21 +0100 Subject: [PATCH] #300: better guard around nil properties --- src/clj/commiteth/bounties.clj | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/clj/commiteth/bounties.clj b/src/clj/commiteth/bounties.clj index 3358015..827f1c5 100644 --- a/src/clj/commiteth/bounties.clj +++ b/src/clj/commiteth/bounties.clj @@ -107,12 +107,14 @@ (issues/update-issue-title (:id gh-issue) (:title gh-issue))))))) (defn bounty-state [bounty] - (cond - (:payout_hash bounty) :paid - (nil? (:confirm_hash bounty)) :pending-maintainer-confirmation - (nil? (:payout_address bounty)) :pending-contributor-address - (:winner_login bounty) :merged - (some-> (:claim_count bounty) (< 1)) :multiple_claims - (= 1 (:claim_count bounty)) :claimed - (seq (:tokens bounty)) :funded - (:contract_address bounty) :opened)) + (if-let [merged? (:winner_login bounty)] + (cond + (nil? (:payout_address bounty)) :pending-contributor-address + (nil? (:confirm_hash bounty)) :pending-maintainer-confirmation + (:payout_hash bounty) :paid + :else :merged) + (cond ; not yet merged + (some-> (:claim_count bounty) (< 1)) :multiple_claims + (= 1 (:claim_count bounty)) :claimed + (seq (:tokens bounty)) :funded + (:contract_address bounty) :opened)))