Improve query for bounty-claim events in activity feed

* include pull-requests in activity feed that have been merged but are
  pending maintainer confirmation or bounty hunter to save own
  ethereum address
This commit is contained in:
Teemu Patja 2017-03-12 19:06:51 +02:00
parent 3a29a577de
commit b788f91149
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
CREATE OR REPLACE VIEW "public"."activity_feed_view" AS SELECT 'open-claim'::text AS type,
claims_view.issue_title,
claims_view.repo_name,
claims_view.repo_owner,
claims_view.issue_number,
claims_view.user_name,
claims_view.user_avatar_url,
claims_view.balance,
claims_view.updated
FROM claims_view
WHERE claims_view.pr_state in (0,1) AND claims_view.payout_receipt IS NULL
UNION
SELECT 'claim-payout'::text AS type,
claims_view.issue_title,
claims_view.repo_name,
claims_view.repo_owner,
claims_view.issue_number,
claims_view.user_name,
claims_view.user_avatar_url,
claims_view.balance,
claims_view.updated
FROM claims_view
WHERE claims_view.pr_state = 1 AND claims_view.payout_receipt IS NOT NULL
UNION
SELECT 'new-bounty'::text AS type,
bounties_view.issue_title,
bounties_view.repo_name,
bounties_view.repo_owner,
bounties_view.issue_number,
bounties_view.user_name,
bounties_view.user_avatar_url,
bounties_view.balance,
bounties_view.updated
FROM bounties_view
WHERE bounties_view.balance = 0::numeric AND bounties_view.payout_receipt IS NULL
UNION
SELECT 'balance-update'::text AS type,
bounties_view.issue_title,
bounties_view.repo_name,
bounties_view.repo_owner,
bounties_view.issue_number,
bounties_view.user_name,
bounties_view.user_avatar_url,
bounties_view.balance,
bounties_view.updated
FROM bounties_view
WHERE bounties_view.balance > 0::numeric AND bounties_view.payout_receipt IS NULL
ORDER BY updated DESC;