Skip to content

Commit

Permalink
Fix count of finished runs
Browse files Browse the repository at this point in the history
Query the database instead of filter the runs later.
This ensures that the count of finished and not deleted runs will be correct.
This also fixes the pagination, some pages ended up having less than page_size runs.
  • Loading branch information
dav1312 committed Sep 24, 2022
1 parent 2ab066c commit d560b39
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def get_finished_runs(
yellow_only=False,
ltc_only=False,
):
q = {"finished": True}
q = {"finished": True, "deleted": False}
if username:
q["args.username"] = username
if ltc_only:
Expand All @@ -489,8 +489,7 @@ def get_finished_runs(

count = self.runs.count_documents(q)

# Don't show runs that were deleted
runs_list = [run for run in c if not run.get("deleted")]
runs_list = list(c)
return [runs_list, count]

def get_results(self, run, save_run=True):
Expand Down

0 comments on commit d560b39

Please sign in to comment.