Simple "open bounties" view
* add simple tab for showing all open bounties (#37). Probably needs some UX improvements * rename old "bounties" tab to "manage payouts" * fix issues in db migration
This commit is contained in:
parent
020f9cdc5d
commit
b25e01f14d
|
@ -1,12 +1,12 @@
|
|||
|
||||
drop table usage_metrics;
|
||||
drop table if exists usage_metrics;
|
||||
CREATE TABLE usage_metrics (
|
||||
registered_users int,
|
||||
users_with_address int,
|
||||
change_timestamp timestamp without time zone
|
||||
DEFAULT timezone('utc'::text, now()));
|
||||
|
||||
|
||||
drop function if exists store_usage_metrics() cascade;
|
||||
CREATE OR REPLACE FUNCTION store_usage_metrics() RETURNS TRIGGER AS $usage_metrics$
|
||||
BEGIN
|
||||
insert into usage_metrics (registered_users, users_with_address)
|
||||
|
|
|
@ -293,7 +293,31 @@ updated = timezone('utc'::text, now())
|
|||
WHERE issue_id = :issue_id;
|
||||
|
||||
|
||||
-- :name owner-bounties-list :? :*
|
||||
-- :name open-bounties :? :*
|
||||
-- :doc all bounty issues for given owner
|
||||
SELECT
|
||||
i.contract_address AS contract_address,
|
||||
i.issue_id AS issue_id,
|
||||
i.issue_number AS issue_number,
|
||||
i.title AS issue_title,
|
||||
i.repo_id AS repo_id,
|
||||
i.balance AS balance,
|
||||
i.confirm_hash AS confirm_hash,
|
||||
i.payout_hash AS payout_hash,
|
||||
i.payout_receipt AS payout_receipt,
|
||||
i.updated AS updated,
|
||||
r.owner AS repo_owner,
|
||||
r.owner_avatar_url AS repo_owner_avatar_url,
|
||||
r.repo AS repo_name
|
||||
FROM issues i, repositories r
|
||||
WHERE
|
||||
r.repo_id = i.repo_id
|
||||
AND i.confirm_hash is null
|
||||
ORDER BY balance desc, updated desc;
|
||||
|
||||
|
||||
|
||||
-- :name owner-bounties :? :*
|
||||
-- :doc all bounty issues for given owner
|
||||
SELECT
|
||||
i.contract_address AS contract_address,
|
||||
|
@ -348,27 +372,6 @@ AND r.user_id = o.id
|
|||
AND i.issue_id = :issue_id;
|
||||
|
||||
|
||||
|
||||
-- :name owner-issues-list :? :*
|
||||
-- :doc owner's bounty issues with no merged PR
|
||||
SELECT
|
||||
i.contract_address AS contract_address,
|
||||
i.issue_id AS issue_id,
|
||||
i.issue_number AS issue_number,
|
||||
i.title AS issue_title,
|
||||
i.repo_id AS repo_id,
|
||||
r.owner AS repo_owner,
|
||||
r.repo AS repo_name
|
||||
FROM issues i, repositories r
|
||||
WHERE r.repo_id = i.repo_id
|
||||
AND r.user_id = :owner_id
|
||||
AND i.commit_sha IS NULL
|
||||
AND NOT exists(SELECT 1
|
||||
FROM pull_requests
|
||||
WHERE issue_number = i.issue_number
|
||||
AND state = 1);
|
||||
|
||||
|
||||
-- :name open-bounty-contracts :? :*
|
||||
-- :doc bounty issues with mined bounty contracts
|
||||
SELECT
|
||||
|
|
|
@ -10,21 +10,20 @@
|
|||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/pending-contracts con-db)))
|
||||
|
||||
(defn list-owner-bounties
|
||||
[owner]
|
||||
(defn owner-bounties
|
||||
[owner-id]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/owner-bounties-list con-db {:owner_id owner})))
|
||||
(db/owner-bounties con-db {:owner_id owner-id})))
|
||||
|
||||
(defn open-bounties
|
||||
[]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/open-bounties con-db)))
|
||||
|
||||
(defn bounty-claims
|
||||
[issue-id]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/bounty-claims con-db {
|
||||
:issue_id issue-id})))
|
||||
|
||||
(defn list-not-fixed-issues
|
||||
[owner-id]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
(db/owner-issues-list con-db {:owner_id owner-id})))
|
||||
(db/bounty-claims con-db {:issue_id issue-id})))
|
||||
|
||||
(defn pending-bounties-list
|
||||
[]
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
(format "%.4f" n))
|
||||
|
||||
(defn user-bounties [user]
|
||||
(let [owner-bounties (bounties-db/list-owner-bounties (:id user))]
|
||||
(let [owner-bounties (bounties-db/owner-bounties (:id user))]
|
||||
(into {}
|
||||
(for [ob owner-bounties
|
||||
:let [b (update ob :balance decimal->str)]]
|
||||
|
@ -156,6 +156,9 @@
|
|||
(GET "/activity-feed" []
|
||||
(log/debug "/activity-feed")
|
||||
(ok (activity-feed)))
|
||||
(GET "/open-bounties" []
|
||||
(log/debug "/open-bounties")
|
||||
(ok (bounties-db/open-bounties)))
|
||||
(context "/user" []
|
||||
(GET "/" []
|
||||
:auth-rules authenticated?
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
[commiteth.handlers]
|
||||
[commiteth.subscriptions]
|
||||
[commiteth.activity :refer [activity-page]]
|
||||
[commiteth.repos :refer [repos-page]]
|
||||
[commiteth.bounties :refer [bounties-page]]
|
||||
[commiteth.repos :refer [repos-page]]
|
||||
[commiteth.manage-payouts :refer [manage-payouts-page]]
|
||||
[commiteth.update-address :refer [update-address-page]]
|
||||
[commiteth.common :refer [input]]
|
||||
[commiteth.config :as config]
|
||||
|
@ -72,8 +73,9 @@
|
|||
(fn []
|
||||
(let [tabs (apply conj [[:activity "Activity"]]
|
||||
(when @user
|
||||
[[:repos "Repositories"]
|
||||
[:bounties "Bounties"]]))]
|
||||
[[:bounties "Open bounties"]
|
||||
[:repos "Repositories"]
|
||||
[:manage-payouts "Manage Payouts"]]))]
|
||||
(into [:div.ui.attached.tabular.menu.tiny.commiteth-tabs]
|
||||
(for [[page caption] tabs]
|
||||
(let [props {:class (str "ui item"
|
||||
|
@ -105,8 +107,9 @@
|
|||
|
||||
(def pages
|
||||
{:activity #'activity-page
|
||||
:repos #'repos-page
|
||||
:bounties #'bounties-page
|
||||
:repos #'repos-page
|
||||
:manage-payouts #'manage-payouts-page
|
||||
:update-address #'update-address-page})
|
||||
|
||||
|
||||
|
|
|
@ -5,24 +5,19 @@
|
|||
:user nil
|
||||
:repos-loading? false
|
||||
:repos {}
|
||||
:open-bounties [{:confirm_hash nil,
|
||||
:issue_id 207799767,
|
||||
:issue_number 19,
|
||||
:repo_name "commiteth",
|
||||
:updated #inst "2017-03-16T18:32:43.113-00:00",
|
||||
:issue_title "Estimate gas instead of hard-coding",
|
||||
:repo_owner "status-im",
|
||||
:repo_owner_avatar_url "https://avatars2.githubusercontent.com/u/11767950?v=3"
|
||||
:balance 0.0M,
|
||||
:payout_receipt nil,
|
||||
:repo_id 65593470,
|
||||
:contract_address "0xaf77604e06169b210158f00ad4d3ef028aecded9",
|
||||
:payout_hash nil}]
|
||||
:owner-bounties {}
|
||||
:top-hunters []
|
||||
:activity-feed [] #_[{:type :create-bounty
|
||||
:user {:display-name "Dummy User"
|
||||
:avatar-url "https://randomuser.me/api/portraits/men/6.jpg"}
|
||||
:issue-title "Feature X"
|
||||
:issue-url "https://github.com/foo/bar/issues/2"
|
||||
:timestamp "1 day ago"}
|
||||
{:type :submit-claim
|
||||
:user {:display-name "Place Holder"
|
||||
:avatar-url "https://randomuser.me/api/portraits/men/4.jpg"}
|
||||
:balance-eth "15"
|
||||
:timestamp "2 days ago"}
|
||||
{:type :balance-update
|
||||
:user {:display-name "Place Holder"
|
||||
:avatar-url "https://randomuser.me/api/portraits/men/4.jpg"}
|
||||
|
||||
:issue-title "Feature Y"
|
||||
:issue-url "https://github.com/foo/bar/issues/1"
|
||||
:balance-eth "15"
|
||||
:timestamp "2 days ago"}]})
|
||||
:activity-feed []})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(ns commiteth.bounties
|
||||
(ns commiteth.manage-payouts
|
||||
(:require [re-frame.core :as rf]
|
||||
[commiteth.common :refer [moment-timestamp]]))
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
|||
paid? (not-empty (:payout_hash claim))
|
||||
confirming? (:confirming? bounty)
|
||||
updated (:updated bounty)]
|
||||
(println "paid?" paid? "merged?" merged? (and merged? ((comp not) paid?)))
|
||||
[:div.activity-item
|
||||
[:div.ui.grid.container
|
||||
[:div.left-column
|
||||
|
@ -56,7 +55,7 @@
|
|||
[claim-card bounty claim]))))
|
||||
|
||||
|
||||
(defn bounties-page []
|
||||
(defn manage-payouts-page []
|
||||
(let [owner-bounties (rf/subscribe [:owner-bounties])]
|
||||
(fn []
|
||||
(let [web3 (.-web3 js/window)
|
|
@ -27,9 +27,9 @@
|
|||
(:flash-message db)))
|
||||
|
||||
(reg-sub
|
||||
:all-bounties
|
||||
:open-bounties
|
||||
(fn [db _]
|
||||
(:all-bounties db)))
|
||||
(:open-bounties db)))
|
||||
|
||||
(reg-sub
|
||||
:owner-bounties
|
||||
|
|
Loading…
Reference in New Issue