diff --git a/resources/migrations/20171102154114-store-winner-login.down.sql b/resources/migrations/20171102154114-store-winner-login.down.sql
new file mode 100644
index 0000000..e69de29
diff --git a/resources/migrations/20171102154114-store-winner-login.up.sql b/resources/migrations/20171102154114-store-winner-login.up.sql
new file mode 100644
index 0000000..be37ed5
--- /dev/null
+++ b/resources/migrations/20171102154114-store-winner-login.up.sql
@@ -0,0 +1 @@
+ALTER TABLE "public"."issues" ADD COLUMN "winner_login" text;
diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql
index 6ade165..e84c1a2 100644
--- a/resources/sql/queries.sql
+++ b/resources/sql/queries.sql
@@ -310,24 +310,6 @@ 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
@@ -342,6 +324,11 @@ SET execute_hash = :execute_hash,
updated = timezone('utc'::text, now())
WHERE issue_id = :issue_id;
+-- :name update-winner-login :! :n
+UPDATE issues
+SET winner_login = :winner_login
+WHERE issue_id = :issue_id;
+
-- :name update-payout-hash :! :n
-- :doc updates issue with payout transaction hash
UPDATE issues
@@ -352,7 +339,8 @@ WHERE issue_id = :issue_id;
-- :name reset-payout-hash :! :n
-- :doc sets issue's payout transaction hash to NULL
UPDATE issues
-SET payout_hash = NULL
+SET payout_hash = NULL,
+winner_login = NULL
WHERE issue_id = :issue_id;
@@ -436,6 +424,7 @@ SELECT
i.payout_hash AS payout_hash,
i.payout_receipt AS payout_receipt,
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
diff --git a/resources/templates/index.html b/resources/templates/index.html
index a53913d..b8ee11f 100644
--- a/resources/templates/index.html
+++ b/resources/templates/index.html
@@ -56,7 +56,7 @@
-
Hey Welcome to Status Open Bounty
Learn more
+
Hey Welcome to Status Open Bounty
$1M Bounty fund for open source projects on the way
Learn more
diff --git a/src/clj/commiteth/db/bounties.clj b/src/clj/commiteth/db/bounties.clj
index 27ccf7e..0032df2 100644
--- a/src/clj/commiteth/db/bounties.clj
+++ b/src/clj/commiteth/db/bounties.clj
@@ -50,6 +50,11 @@
(jdbc/with-db-connection [con-db *db*]
(db/update-execute-hash con-db {:issue_id issue-id :execute_hash execute-hash})))
+(defn update-winner-login
+ [issue-id login]
+ (jdbc/with-db-connection [con-db *db*]
+ (db/update-winner-login con-db {:issue_id issue-id :winner_login login})))
+
(defn update-payout-hash
[issue-id payout-hash]
(jdbc/with-db-connection [con-db *db*]
@@ -71,11 +76,6 @@
(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
[]
(jdbc/with-db-connection [con-db *db*]
diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj
index e7c6185..f9f9bbc 100644
--- a/src/clj/commiteth/routes/services.clj
+++ b/src/clj/commiteth/routes/services.clj
@@ -126,10 +126,9 @@
(let [owner-bounties (bounties-db/owner-bounties (:id user))]
(into {}
(for [ob owner-bounties
- :let [b (update ob :value_usd usd-decimal->str)
- winner (first (bounties-db/get-bounty-winner (:issue_id b)))]]
+ :let [b (update ob :value_usd usd-decimal->str)]]
[(:issue_id b)
- (conj (conj b {:winner winner})
+ (conj b
(let [claims (map
#(update % :value_usd usd-decimal->str)
(bounties-db/bounty-claims (:issue_id b)))]
diff --git a/src/clj/commiteth/scheduler.clj b/src/clj/commiteth/scheduler.clj
index 531c6b9..3d76ee2 100644
--- a/src/clj/commiteth/scheduler.clj
+++ b/src/clj/commiteth/scheduler.clj
@@ -97,6 +97,7 @@
(let [execute-hash (multisig/send-all contract-address payout-address)]
(log/info "Payout self-signed, called sign-all(" contract-address payout-address ") tx:" execute-hash)
(db-bounties/update-execute-hash issue-id execute-hash)
+ (db-bounties/update-winner-login issue-id winner-login)
(github/update-merged-issue-comment owner
repo
comment-id
diff --git a/src/cljs/commiteth/manage_payouts.cljs b/src/cljs/commiteth/manage_payouts.cljs
index 79674bd..89c688f 100644
--- a/src/cljs/commiteth/manage_payouts.cljs
+++ b/src/cljs/commiteth/manage_payouts.cljs
@@ -17,8 +17,7 @@
issue-title :issue_title} claim
merged? (= 1 (:pr_state claim))
paid? (not-empty (:payout_hash claim))
- winner (:winner bounty)
- winner-login (:payee_login winner)
+ winner-login (:winner_login bounty)
bot-confirm-unmined? (empty? (:confirm_hash bounty))
confirming? (:confirming? bounty)
updated (:updated bounty)]
diff --git a/static_langing_page/index.html b/static_langing_page/index.html
index a53913d..b8ee11f 100644
--- a/static_langing_page/index.html
+++ b/static_langing_page/index.html
@@ -56,7 +56,7 @@
-
Hey Welcome to Status Open Bounty
Learn more
+
Hey Welcome to Status Open Bounty
$1M Bounty fund for open source projects on the way
Learn more