Skip to content

Commit

Permalink
feat: improve next patch suggestion order
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Oct 24, 2024
1 parent 2213452 commit 49450f0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions server/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,13 @@ async def __accept_patch_update(
)

next_pk = await conn.fetchval(
"select id from view_subject_patch where state = $1 order by random() limit 1",
"""
select id from view_subject_patch
where state = $1 and created_at < $2
order by created_at desc limit 1
""",
PatchState.Pending,
patch.created_at,
)

if next_pk:
Expand Down Expand Up @@ -423,8 +428,13 @@ async def __accept_episode_patch(
)

next_pk = await conn.fetchval(
"select id from view_episode_patch where state = $1 order by random() limit 1",
"""
select id from view_episode_patch
where state = $1 and created_at < $2
order by created_at desc limit 1
""",
PatchState.Pending,
patch.created_at,
)

if next_pk:
Expand Down

0 comments on commit 49450f0

Please sign in to comment.