Skip to content

Commit 34ed291

Browse files
committed
Excudes deleted projects
1 parent f108dc4 commit 34ed291

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/ftpdb/DB.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ defmodule Ftpdb.DB do
4949
}
5050
end
5151

52+
defp exclude_deleted_projects(query) do
53+
Supabase.PostgREST.any_of(query, "ship_status.is.null,ship_status.neq.deleted")
54+
end
55+
5256
def hot do
5357
{:ok, response} =
5458
Supabase.PostgREST.from(client(), "projects")
@@ -60,6 +64,7 @@ defmodule Ftpdb.DB do
6064
"stat_hot_score",
6165
"stat_total_likes"
6266
])
67+
|> exclude_deleted_projects()
6368
|> Supabase.PostgREST.order("stat_hot_score", desc: true)
6469
|> Supabase.PostgREST.limit(10)
6570
|> Map.put(:method, :get)
@@ -96,6 +101,7 @@ defmodule Ftpdb.DB do
96101
{:ok, response} =
97102
Supabase.PostgREST.from(client(), "projects")
98103
|> Supabase.PostgREST.select(["title", "id", "stat_weekly_rank", "banner_url"])
104+
|> exclude_deleted_projects()
99105
|> Supabase.PostgREST.order("stat_weekly_rank", asc: true)
100106
|> Supabase.PostgREST.limit(10)
101107
|> Map.put(:method, :get)
@@ -131,6 +137,7 @@ defmodule Ftpdb.DB do
131137
"stat_total_likes",
132138
"stat_total_duration_seconds"
133139
])
140+
|> exclude_deleted_projects()
134141
|> Supabase.PostgREST.order("stat_total_likes", desc: true)
135142
|> Supabase.PostgREST.limit(10)
136143
|> Map.put(:method, :get)
@@ -163,6 +170,7 @@ defmodule Ftpdb.DB do
163170
{:ok, response} =
164171
Supabase.PostgREST.from(client(), "projects")
165172
|> Supabase.PostgREST.select(["title", "id", "stat_all_time_rank", "banner_url"])
173+
|> exclude_deleted_projects()
166174
|> Supabase.PostgREST.order("stat_all_time_rank", asc: true)
167175
|> Supabase.PostgREST.limit(10)
168176
|> Map.put(:method, :get)

0 commit comments

Comments
 (0)