From ec2ac80478c2863f3a34ceedba23357d1a7ec0d4 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Thu, 2 Nov 2017 12:41:27 +0200 Subject: [PATCH] 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 ) instead of (paid) on manage payouts view --- resources/sql/queries.sql | 24 ++++++++++++++++++++---- src/clj/commiteth/db/bounties.clj | 4 ++++ src/clj/commiteth/routes/services.clj | 5 +++-- src/cljs/commiteth/manage_payouts.cljs | 6 ++++-- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 47e2bdb..6ade165 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -128,16 +128,14 @@ INSERT INTO issues (repo_id, issue_id, issue_number, title) -- :name update-commit-sha :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)))] diff --git a/src/cljs/commiteth/manage_payouts.cljs b/src/cljs/commiteth/manage_payouts.cljs index b9d6475..e7728bb 100644 --- a/src/cljs/commiteth/manage_payouts.cljs +++ b/src/cljs/commiteth/manage_payouts.cljs @@ -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