Skip to content

Commit

Permalink
perf
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 24, 2024
1 parent 4803cd5 commit 54fbb2f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions server/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,18 @@ async def index(
if page > total_page:
return Redirect(f"/?type={patch_type}&reviewed={int(reviewed)}&page=1")

rows = await pg.fetch(
query.select("*")
.where(where)
.limit(_page_size)
.offset((page - 1) * _page_size)
.orderby(order_field, order=order_sort)
.get_sql(),
PatchState.Pending,
)
if total == 0:
rows = []
else:
rows = await pg.fetch(
query.select("*")
.where(where)
.limit(_page_size)
.offset((page - 1) * _page_size)
.orderby(order_field, order=order_sort)
.get_sql(),
PatchState.Pending,
)

pending_episode = await pg.fetchval(
"select count(1) from episode_patch where deleted_at is NULL and state = $1",
Expand Down

0 comments on commit 54fbb2f

Please sign in to comment.