Fix issues with db field renaming
This commit is contained in:
parent
bbf96cc497
commit
329e73e906
|
@ -365,9 +365,9 @@ WHERE watch_hash IS NOT NULL;
|
||||||
-- :name update-payout-hash :! :n
|
-- :name update-payout-hash :! :n
|
||||||
-- :doc updates issue with payout transaction hash
|
-- :doc updates issue with payout transaction hash
|
||||||
UPDATE issues
|
UPDATE issues
|
||||||
SET payout_hash = :payout-hash,
|
SET payout_hash = :payout_hash,
|
||||||
updated = timezone('utc'::text, now())
|
updated = timezone('utc'::text, now())
|
||||||
WHERE issue_id = :issue-id;
|
WHERE issue_id = :issue_id;
|
||||||
|
|
||||||
-- :name reset-payout-hash :! :n
|
-- :name reset-payout-hash :! :n
|
||||||
-- :doc sets issue's payout transaction hash to NULL
|
-- :doc sets issue's payout transaction hash to NULL
|
||||||
|
@ -380,9 +380,9 @@ WHERE issue_id = :issue_id;
|
||||||
-- :name update-payout-receipt :! :n
|
-- :name update-payout-receipt :! :n
|
||||||
-- :doc updates issue with payout transaction receipt
|
-- :doc updates issue with payout transaction receipt
|
||||||
UPDATE issues
|
UPDATE issues
|
||||||
SET payout_receipt = :payout-receipt::jsonb,
|
SET payout_receipt = :payout_receipt::jsonb,
|
||||||
updated = timezone('utc'::text, now())
|
updated = timezone('utc'::text, now())
|
||||||
WHERE issue_id = :issue-id;
|
WHERE issue_id = :issue_id;
|
||||||
|
|
||||||
-- :name update-issue-open :! :n
|
-- :name update-issue-open :! :n
|
||||||
-- :doc updates issue's open status
|
-- :doc updates issue's open status
|
||||||
|
@ -556,7 +556,7 @@ SELECT
|
||||||
r.owner AS owner,
|
r.owner AS owner,
|
||||||
r.repo AS repo
|
r.repo AS repo
|
||||||
FROM issues i, repositories r
|
FROM issues i, repositories r
|
||||||
WHERE i.issue_number = :issue-number
|
WHERE i.issue_number = :issue_number
|
||||||
AND r.repo_id = i.repo_id
|
AND r.repo_id = i.repo_id
|
||||||
AND r.owner = :owner
|
AND r.owner = :owner
|
||||||
AND r.repo = :repo;
|
AND r.repo = :repo;
|
||||||
|
@ -564,11 +564,11 @@ AND r.repo = :repo;
|
||||||
-- :name update-balances :! :n
|
-- :name update-balances :! :n
|
||||||
-- :doc updates balance of a wallet attached to a given issue
|
-- :doc updates balance of a wallet attached to a given issue
|
||||||
UPDATE issues
|
UPDATE issues
|
||||||
SET balance_eth = :balance-eth,
|
SET balance_eth = :balance_eth,
|
||||||
tokens = :token-balances::jsonb,
|
tokens = :token_balances::jsonb,
|
||||||
value_usd = :usd-value,
|
value_usd = :usd_value,
|
||||||
updated = timezone('utc'::text, now())
|
updated = timezone('utc'::text, now())
|
||||||
WHERE contract_address = :contract-address;
|
WHERE contract_address = :contract_address;
|
||||||
|
|
||||||
|
|
||||||
-- :name save-issue-comment-image! :<! :1
|
-- :name save-issue-comment-image! :<! :1
|
||||||
|
|
|
@ -58,13 +58,15 @@
|
||||||
(tracker/untrack-tx! tx-info)
|
(tracker/untrack-tx! tx-info)
|
||||||
|
|
||||||
:update-balances
|
:update-balances
|
||||||
(issues/update-balances (:contract-address bounty)
|
(do
|
||||||
(:balance-eth bounty)
|
(github/update-bounty-comment-image bounty)
|
||||||
(:tokens bounty)
|
(issues/update-balances (:contract-address bounty)
|
||||||
(:value-usd bounty))
|
(:balance-eth bounty)
|
||||||
|
(:tokens bounty)
|
||||||
|
(:value-usd bounty)))
|
||||||
|
|
||||||
)
|
)
|
||||||
(github/update-comment bounty state))))
|
(github/update-comment bounty state))))
|
||||||
(defn deploy-contract [owner-address issue-id]
|
(defn deploy-contract [owner-address issue-id]
|
||||||
(if (empty? owner-address)
|
(if (empty? owner-address)
|
||||||
(log/errorf "issue %s: Unable to deploy bounty contract because repo owner has no Ethereum addres" issue-id)
|
(log/errorf "issue %s: Unable to deploy bounty contract because repo owner has no Ethereum addres" issue-id)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns commiteth.db.bounties
|
(ns commiteth.db.bounties
|
||||||
(:require [commiteth.db.core :refer [*db*] :as db]
|
(:require [commiteth.db.core :refer [*db*] :as db]
|
||||||
[commiteth.util.util :refer [to-db-map]]
|
[commiteth.util.util :refer [to-db-map]]
|
||||||
|
[clojure.tools.logging :as log]
|
||||||
[clojure.java.jdbc :as jdbc]
|
[clojure.java.jdbc :as jdbc]
|
||||||
[clojure.set :refer [rename-keys]]))
|
[clojure.set :refer [rename-keys]]))
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
(defn get-bounty
|
(defn get-bounty
|
||||||
[owner repo issue-number]
|
[owner repo issue-number]
|
||||||
(jdbc/with-db-connection [con-db *db*]
|
(jdbc/with-db-connection [con-db *db*]
|
||||||
|
(log/info "get-bounty params:" (to-db-map owner repo issue-number))
|
||||||
(db/get-bounty con-db (to-db-map owner repo issue-number))))
|
(db/get-bounty con-db (to-db-map owner repo issue-number))))
|
||||||
|
|
||||||
(defn open-bounty-contracts
|
(defn open-bounty-contracts
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
[contract-address balance-eth token-balances usd-value]
|
[contract-address balance-eth token-balances usd-value]
|
||||||
(jdbc/with-db-connection [con-db *db*]
|
(jdbc/with-db-connection [con-db *db*]
|
||||||
(db/update-balances con-db (to-db-map contract-address
|
(db/update-balances con-db (to-db-map contract-address
|
||||||
balance-eth
|
balance-eth
|
||||||
token-balances
|
token-balances
|
||||||
usd-value))))
|
usd-value))))
|
||||||
|
|
||||||
(defn update-open-status
|
(defn update-open-status
|
||||||
[issue-id is-open]
|
[issue-id is-open]
|
||||||
|
|
|
@ -338,7 +338,7 @@
|
||||||
(let [comment (case state
|
(let [comment (case state
|
||||||
:deploying
|
:deploying
|
||||||
(generate-deploying-comment owner repo issue-number transaction-hash)
|
(generate-deploying-comment owner repo issue-number transaction-hash)
|
||||||
:opened
|
(:opened :update-balances)
|
||||||
(generate-open-comment owner
|
(generate-open-comment owner
|
||||||
repo
|
repo
|
||||||
issue-number
|
issue-number
|
||||||
|
|
|
@ -12,21 +12,18 @@
|
||||||
(context "/qr" []
|
(context "/qr" []
|
||||||
(GET "/:owner/:repo/bounty/:issue{[0-9]{1,9}}/:hash/qr.png" [owner repo issue hash]
|
(GET "/:owner/:repo/bounty/:issue{[0-9]{1,9}}/:hash/qr.png" [owner repo issue hash]
|
||||||
(log/debug "qr PNG GET" owner repo issue hash)
|
(log/debug "qr PNG GET" owner repo issue hash)
|
||||||
(if-let [{address :contract_address
|
(if-let [{:keys [contract-address repo issue-id balance-eth]}
|
||||||
repo :repo
|
|
||||||
issue-id :issue_id
|
|
||||||
balance-eth :balance_eth}
|
|
||||||
(bounties/get-bounty owner
|
(bounties/get-bounty owner
|
||||||
repo
|
repo
|
||||||
(Integer/parseInt issue))]
|
(Integer/parseInt issue))]
|
||||||
(do
|
(do
|
||||||
(log/debug "address:" address)
|
(log/debug "address:" contract-address)
|
||||||
(log/debug owner repo issue balance-eth)
|
(log/debug owner repo issue balance-eth)
|
||||||
(log/debug hash (github/github-comment-hash owner repo issue balance-eth))
|
(log/debug hash (github/github-comment-hash owner repo issue balance-eth))
|
||||||
(if address
|
(if contract-address
|
||||||
(if-let [{png-data :png_data}
|
(if-let [{:keys [png-data]}
|
||||||
(comment-images/get-image-data
|
(comment-images/get-image-data
|
||||||
issue-id hash)]
|
issue-id hash)]
|
||||||
(do (log/debug "PNG found")
|
(do (log/debug "PNG found")
|
||||||
{:status 200
|
{:status 200
|
||||||
:content-type "image/png"
|
:content-type "image/png"
|
||||||
|
|
Loading…
Reference in New Issue