Skip to content

Commit 5beea61

Browse files
committed
init bounty page
1 parent 66b3985 commit 5beea61

File tree

5 files changed

+525
-2
lines changed

5 files changed

+525
-2
lines changed

lib/algora/accounts/accounts.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ defmodule Algora.Accounts do
132132
type: u.type,
133133
id: u.id,
134134
handle: u.handle,
135+
provider_login: u.provider_login,
135136
name: u.name,
136137
avatar_url: u.avatar_url,
137138
bio: u.bio,

lib/algora/admin/admin.ex

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ defmodule Algora.Admin do
22
@moduledoc false
33
import Ecto.Query
44

5+
alias Algora.Accounts
56
alias Algora.Accounts.User
67
alias Algora.Bounties.Claim
78
alias Algora.Parser
@@ -12,6 +13,57 @@ defmodule Algora.Admin do
1213

1314
require Logger
1415

16+
def seed do
17+
import Algora.Factory
18+
19+
title = "Monthly PR Review & Triage Bounty"
20+
21+
description = """
22+
## What needs doing
23+
24+
Review open pull requests across our repos and:
25+
26+
1. Test them locally
27+
2. Leave helpful comments
28+
3. Merge or close stale PRs
29+
4. Tag relevant people when needed
30+
31+
## Success looks like
32+
33+
- [ ] All PRs older than 2 weeks have been reviewed
34+
- [ ] Clear comments left on PRs needing changes
35+
- [ ] Stale PRs (>30 days old) closed with explanation
36+
- [ ] Weekly summary posted in #dev channel
37+
"""
38+
39+
org = Repo.get_by!(User, handle: "piedpiper0")
40+
user = Repo.get_by!(User, handle: "zcesur")
41+
42+
repository = insert!(:repository, user: org)
43+
ticket = insert!(:ticket, title: title, repository: repository, description: description)
44+
bounty = insert!(:bounty, ticket: ticket, owner: org, creator: user, amount: Money.new(1000, :USD))
45+
46+
for contributor <- Accounts.list_featured_developers() do
47+
insert!(:transaction,
48+
type: :debit,
49+
net_amount: Money.new(1000, :USD),
50+
user_id: org.id,
51+
bounty_id: bounty.id,
52+
status: :succeeded
53+
)
54+
55+
insert!(:transaction,
56+
type: :credit,
57+
net_amount: Money.new(1000, :USD),
58+
user_id: contributor.id,
59+
bounty_id: bounty.id,
60+
status: :succeeded
61+
)
62+
end
63+
64+
IO.puts("#{AlgoraWeb.Endpoint.url()}/org/#{org.handle}/bounties/#{bounty.id}")
65+
end
66+
1567
def token!, do: System.fetch_env!("ADMIN_GITHUB_TOKEN")
1668

1769
def run(worker) do

lib/algora/bounties/bounties.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ defmodule Algora.Bounties do
628628
bounty_id: String.t(),
629629
claims: [Claim.t()]
630630
},
631-
opts :: [ticket_ref: %{owner: String.t(), repo: String.t(), number: integer()}]
631+
opts :: [ticket_ref: %{owner: String.t(), repo: String.t(), number: integer()}, recipient: User.t()]
632632
) ::
633633
{:ok, String.t()} | {:error, atom()}
634634
def reward_bounty(%{owner: owner, amount: amount, bounty_id: bounty_id, claims: claims}, opts \\ []) do
@@ -640,7 +640,8 @@ defmodule Algora.Bounties do
640640
%{owner: owner, amount: amount, description: "Bounty payment for OSS contributions"},
641641
ticket_ref: opts[:ticket_ref],
642642
bounty_id: bounty_id,
643-
claims: claims
643+
claims: claims,
644+
recipient: opts[:recipient]
644645
)
645646
end
646647
end)

0 commit comments

Comments
 (0)