Skip to content

Commit 52c3155

Browse files
committed
feat: enhance contributor queries to exclude organization members
1 parent b254f39 commit 52c3155

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/algora/workspace/workspace.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule Algora.Workspace do
66
alias Algora.Accounts
77
alias Algora.Accounts.User
88
alias Algora.Github
9+
alias Algora.Organizations.Member
910
alias Algora.Repo
1011
alias Algora.Util
1112
alias Algora.Workspace.CommandResponse
@@ -531,6 +532,9 @@ defmodule Algora.Workspace do
531532
join: u in assoc(c, :user),
532533
where: u.type != :bot,
533534
where: not ilike(u.provider_login, "%bot"),
535+
left_join: m in Member,
536+
on: m.user_id == u.id and m.org_id == r.user_id,
537+
where: is_nil(m.id),
534538
select_merge: %{user: u},
535539
order_by: [desc: c.contributions, asc: c.inserted_at, asc: c.id]
536540
)
@@ -547,6 +551,9 @@ defmodule Algora.Workspace do
547551
join: u in assoc(c, :user),
548552
where: u.type != :bot,
549553
where: not ilike(u.provider_login, "%bot"),
554+
left_join: m in Member,
555+
on: m.user_id == u.id and m.org_id == r.user_id,
556+
where: is_nil(m.id),
550557
distinct: [c.user_id],
551558
select_merge: %{user: u},
552559
order_by: [desc: c.contributions, asc: c.inserted_at, asc: c.id],

0 commit comments

Comments
 (0)