Skip to content

Commit

Permalink
exclude jobs with "removed" status from the list of jobs endpoint (bu…
Browse files Browse the repository at this point in the history
…t not from the statistics endpoints)
  • Loading branch information
apdavison committed Jan 26, 2024
1 parent fa4fe01 commit 3c0e1f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/simqueue/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,11 @@ async def query_jobs(
fields: List[str] = None,
from_index: int = 0,
size: int = 10,
exclude_removed=False,
):
filters = []
if exclude_removed:
filters.append(jobs.c.status != "removed")
if status:
filters.append(get_list_filter(jobs.c.status, status))
if user_id:
Expand Down
1 change: 1 addition & 0 deletions api/simqueue/resources/for_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ async def query_jobs(
date_range_end=date_range_end,
from_index=from_index,
size=size,
exclude_removed=True,
)

return [Job.from_db(job) for job in jobs]
Expand Down

0 comments on commit 3c0e1f1

Please sign in to comment.