#300: add function which returns state of a given bounty

This commit is contained in:
Martin Klepsch 2018-02-21 18:17:32 +01:00 committed by Tetiana Churikova
parent ec2f87e621
commit ef4e1f411e
2 changed files with 14 additions and 2 deletions

View File

@ -453,8 +453,9 @@ SELECT
i.updated AS updated,
i.winner_login AS winner_login,
r.repo AS repo_name,
o.address AS owner_address
FROM issues i, users o, repositories r
o.address AS owner_address,
u.address AS payout_address
FROM users o, repositories r, issues i LEFT OUTER JOIN users u ON u.login = i.winner_login
WHERE
r.repo_id = i.repo_id
AND r.user_id = o.id

View File

@ -105,3 +105,14 @@
(do
(log/info "Updating changed title for issue" (:id gh-issue))
(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))