Skip to content

Commit 33b5e7b

Browse files
committed
refactor: improve bounty ordering logic in BountyLive
- Updated the ordering of bounties in the `BountyLive` module to prioritize the current organization, enhancing the relevance of displayed bounties. - Removed a TODO comment regarding pooling bounties for better code clarity.
1 parent deab5cf commit 33b5e7b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/algora_web/live/bounty_live.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ defmodule AlgoraWeb.BountyLive do
104104
where: u.provider_login == ^repo_owner,
105105
where: r.name == ^repo_name,
106106
where: t.number == ^number,
107-
# TODO: pool bounties
108-
limit: 1,
109-
order_by: [asc: b.inserted_at]
107+
order_by: fragment("CASE WHEN ? = ? THEN 0 ELSE 1 END", u.id, ^socket.assigns.current_org.id),
108+
limit: 1
110109
)
111110
|> Repo.one()
112111
|> Repo.preload([:owner, :creator, :transactions, ticket: [repository: [:user]]])

0 commit comments

Comments
 (0)