Include winner in /user-bounties data & show on manage payouts
* include user-id, login and name of bounty winner in /user-bounties data * show (paid to <github-username>) instead of (paid) on manage payouts view
This commit is contained in:
parent
eaa1aadc1a
commit
ec2ac80478
|
@ -128,16 +128,14 @@ INSERT INTO issues (repo_id, issue_id, issue_number, title)
|
|||
-- :name update-commit-sha :<! :1
|
||||
-- :doc updates issue with commit_sha
|
||||
UPDATE issues
|
||||
SET commit_sha = :commit_sha,
|
||||
updated = timezone('utc'::text, now())
|
||||
SET commit_sha = :commit_sha
|
||||
WHERE issue_id = :issue_id
|
||||
RETURNING repo_id, issue_id, issue_number, title, commit_sha, contract_address;
|
||||
|
||||
-- :name update-transaction-hash :! :n
|
||||
-- :doc updates transaction-hash for a given issue
|
||||
UPDATE issues
|
||||
SET transaction_hash = :transaction_hash,
|
||||
updated = timezone('utc'::text, now())
|
||||
SET transaction_hash = :transaction_hash
|
||||
WHERE issue_id = :issue_id;
|
||||
|
||||
|
||||
|
@ -312,6 +310,24 @@ AND u.id = p.user_id
|
|||
AND i.payout_receipt IS NULL
|
||||
AND i.payout_hash IS NOT NULL;
|
||||
|
||||
|
||||
-- :name get-bounty-winner :? :*
|
||||
-- :doc return user_id, login and name for a user that has won and
|
||||
-- been paid given bounty issue
|
||||
SELECT
|
||||
u.address AS payout_address,
|
||||
u.login AS payee_login,
|
||||
u.id AS payee_user_id,
|
||||
u.name AS payee_name
|
||||
FROM issues i, users u, pull_requests p
|
||||
WHERE
|
||||
i.issue_id = :issue_id
|
||||
AND p.issue_id = i.issue_id
|
||||
AND p.repo_id = i.repo_id
|
||||
AND u.id = p.user_id
|
||||
AND i.payout_receipt IS NOT NULL;
|
||||
|
||||
|
||||
-- :name update-confirm-hash :! :n
|
||||
-- :doc updates issue with confirmation hash
|
||||
UPDATE issues
|
||||
|
|
|
@ -71,6 +71,10 @@
|
|||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/get-bounty con-db {:owner owner :repo repo :issue_number issue-number})))
|
||||
|
||||
(defn get-bounty-winner
|
||||
[issue-id]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/get-bounty-winner con-db {:issue_id issue-id})))
|
||||
|
||||
(defn open-bounty-contracts
|
||||
[]
|
||||
|
|
|
@ -126,9 +126,10 @@
|
|||
(let [owner-bounties (bounties-db/owner-bounties (:id user))]
|
||||
(into {}
|
||||
(for [ob owner-bounties
|
||||
:let [b (update ob :value_usd usd-decimal->str)]]
|
||||
:let [b (update ob :value_usd usd-decimal->str)
|
||||
winner (first (bounties-db/get-bounty-winner (:issue_id b)))]]
|
||||
[(:issue_id b)
|
||||
(conj b
|
||||
(conj (conj b {:winner winner})
|
||||
(let [claims (map
|
||||
#(update % :value_usd usd-decimal->str)
|
||||
(bounties-db/bounty-claims (:issue_id b)))]
|
||||
|
|
|
@ -14,9 +14,11 @@
|
|||
user-name :user_name
|
||||
avatar-url :user_avatar_url
|
||||
issue-id :issue_id
|
||||
issue-title :issue_title} claim
|
||||
issue-title :issue_title
|
||||
winner :winner} claim
|
||||
merged? (= 1 (:pr_state claim))
|
||||
paid? (not-empty (:payout_hash claim))
|
||||
winner-login (:payee_login winner)
|
||||
bot-confirm-unmined? (empty? (:confirm_hash bounty))
|
||||
confirming? (:confirming? bounty)
|
||||
updated (:updated bounty)]
|
||||
|
@ -30,7 +32,7 @@
|
|||
[:div.description "Submitted a claim for " [:a {:href (pr-url claim)}
|
||||
issue-title]]
|
||||
[:div.description (if paid?
|
||||
"(paid)"
|
||||
(str "(paid to " winner-login ")")
|
||||
(str "(" (if merged? "merged" "open") ")"))]
|
||||
[:div.time (moment-timestamp updated)]
|
||||
[:button.ui.button
|
||||
|
|
Loading…
Reference in New Issue