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
14
14
15
15
@ type criterion ::
16
16
{ :id , binary ( ) }
17
+ | { :org_id , binary ( ) }
17
18
| { :limit , non_neg_integer ( ) }
18
19
| { :handle , String . t ( ) }
19
20
| { :handles , [ String . t ( ) ] }
@@ -76,9 +77,17 @@ defmodule Algora.Accounts do
76
77
|> where ( [ u ] , u . type == :individual )
77
78
|> select ( [ b ] , b . id )
78
79
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
+
79
85
earnings_query =
80
86
from t in Transaction ,
81
87
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 ,
82
91
group_by: t . user_id ,
83
92
select: % {
84
93
user_id: t . user_id ,
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ defmodule AlgoraWeb.Org.DashboardPublicLive do
12
12
org = Organizations . get_org_by_handle! ( handle )
13
13
open_bounties = Bounties . list_bounties ( owner_id: org . id , status: :open , limit: 5 )
14
14
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 ) )
16
16
stats = Bounties . fetch_stats ( org . id )
17
17
18
18
socket =
You can’t perform that action at this time.
0 commit comments