set winner_login when handling incoming claims

This commit is contained in:
Martin Klepsch 2018-04-26 15:41:58 +02:00 committed by Tetiana Churikova
parent b0d3222ec4
commit 6ad4f0b548
2 changed files with 9 additions and 7 deletions

View File

@ -7,6 +7,7 @@
[commiteth.bounties :as bounties]
[commiteth.db
[issues :as issues]
[bounties :as db-bounties]
[pull-requests :as pull-requests]
[repositories :as repositories]
[users :as users]]
@ -133,19 +134,17 @@
;; merged
(cond
open-or-edit? (do
(log/info "PR with reference to bounty issue"
(:issue_number issue) "opened")
(log/infof "issue %s: PR with reference to bounty issue opened" (:issue_number issue))
(pull-requests/save (merge pr-data {:state :opened
:commit_sha head-sha})))
close? (if merged?
(do (log/info "PR with reference to bounty issue"
(:issue_number issue) "merged")
(do (log/infof "issue %s: PR with reference to bounty issue merged" (:issue_number issue))
(pull-requests/save
(merge pr-data {:state :merged
:commit_sha head-sha}))
(issues/update-commit-sha (:issue_id issue) head-sha))
(do (log/info "PR with reference to bounty issue"
(:issue_number issue) "closed with no merge")
(issues/update-commit-sha (:issue_id issue) head-sha)
(db-bounties/update-winner-login (:issue_id issue) login))
(do (log/infof "issue %s: PR with reference to bounty issue closed with no merge" (:issue_number issue))
(pull-requests/save
(merge pr-data {:state :closed
:commit_sha head-sha})))))))

View File

@ -116,6 +116,9 @@
tokens :tokens
winner-login :winner_login} (db-bounties/pending-bounties)]
(try
;; TODO(martin) delete this shortly after org-dashboard deploy
;; as we're now setting `winner_login` when handling a new claims
;; coming in via webhooks (see `commiteth.routes.webhooks/handle-claim`)
(db-bounties/update-winner-login issue-id winner-login)
(let [value (eth/get-balance-hex contract-address)]
(if (empty? payout-address)