Merge branch 'develop'

This commit is contained in:
Teemu Patja 2017-11-02 16:04:27 +02:00
commit 5985af1344
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
9 changed files with 20 additions and 31 deletions

View File

@ -0,0 +1 @@
ALTER TABLE "public"."issues" ADD COLUMN "winner_login" text;

View File

@ -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

View File

@ -56,7 +56,7 @@
<body>
<div class="news">
<div class="news-inner">
<strong>Hey</strong> Welcome to Status Open Bounty&nbsp;<a href="#" target="_blank">Learn&nbsp;more</a>
<strong>Hey</strong> Welcome to Status Open Bounty&nbsp;<strong>$1M</strong> Bounty fund for open source projects on the way&nbsp;<a href="#">Learn&nbsp;more</a>
</div>
</div>
<div class="container-wrap">

View File

@ -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*]

View File

@ -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)))]

View File

@ -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

View File

@ -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)]

View File

@ -56,7 +56,7 @@
<body>
<div class="news">
<div class="news-inner">
<strong>Hey</strong> Welcome to Status Open Bounty&nbsp;<a href="#" target="_blank">Learn&nbsp;more</a>
<strong>Hey</strong> Welcome to Status Open Bounty&nbsp;<strong>$1M</strong> Bounty fund for open source projects on the way&nbsp;<a href="#">Learn&nbsp;more</a>
</div>
</div>
<div class="container-wrap">