File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ defmodule Algora.Accounts do
1414
1515 @ type criterion ::
1616 { :id , binary ( ) }
17+ | { :org_id , binary ( ) }
1718 | { :limit , non_neg_integer ( ) }
1819 | { :handle , String . t ( ) }
1920 | { :handles , [ String . t ( ) ] }
@@ -76,9 +77,17 @@ defmodule Algora.Accounts do
7677 |> where ( [ u ] , u . type == :individual )
7778 |> select ( [ b ] , b . id )
7879
80+ filter_org_id =
81+ if org_id = criteria [ :org_id ] ,
82+ do: dynamic ( [ linked_transaction: lt ] , lt . user_id == ^ org_id ) ,
83+ else: true
84+
7985 earnings_query =
8086 from t in Transaction ,
8187 where: t . type == :credit and t . status == :succeeded ,
88+ left_join: lt in assoc ( t , :linked_transaction ) ,
89+ as: :linked_transaction ,
90+ where: ^ filter_org_id ,
8291 group_by: t . user_id ,
8392 select: % {
8493 user_id: t . user_id ,
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ defmodule AlgoraWeb.Org.DashboardPublicLive do
1212 org = Organizations . get_org_by_handle! ( handle )
1313 open_bounties = Bounties . list_bounties ( owner_id: org . id , status: :open , limit: 5 )
1414 completed_bounties = Bounties . list_bounties ( owner_id: org . id , status: :paid , limit: 5 )
15- top_earners = Accounts . list_developers ( limit: 10 )
15+ top_earners = Accounts . list_developers ( org_id: org . id , limit: 10 , min_earnings: Money . zero ( :USD ) )
1616 stats = Bounties . fetch_stats ( org . id )
1717
1818 socket =
You can’t perform that action at this time.
0 commit comments