Skip to content

Commit

Permalink
fix filter
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 24, 2024
1 parent 7478377 commit 34a8058
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ async def index(
)
elif reviewed:
rows = await pg.fetch(
"""select * from patch where deleted_at is NULL and state = $1 order by created_at""",
"""select * from patch where deleted_at is NULL and state != $1 order by updated_at""",
PatchState.Pending,
)
else:
rows = await pg.fetch(
"""select * from patch where deleted_at is NULL and state != $1 order by updated_at""",
"""select * from patch where deleted_at is NULL and state = $1 order by created_at""",
PatchState.Pending,
)

Expand All @@ -156,14 +156,15 @@ async def index(
)
elif reviewed:
rows = await pg.fetch(
"""select * from episode_patch where deleted_at is NULL and state = $1 order by created_at""",
"""select * from episode_patch where deleted_at is NULL and state != $1 order by updated_at""",
PatchState.Pending,
)
else:
rows = await pg.fetch(
"""select * from episode_patch where deleted_at is NULL and state != $1 order by updated_at""",
"""select * from episode_patch where deleted_at is NULL and state = $1 order by created_at""",
PatchState.Pending,
)

else:
raise BadRequestException(f"{patch_type} is not valid")

Expand Down

0 comments on commit 34a8058

Please sign in to comment.