@@ -453,7 +453,7 @@ class JobPaginationDefaultQueryArgs(PaginationDefaultQueryArgs):
453
453
retries_greater_than : Literal [0 , 1 , 2 , 3 ] | None
454
454
retries_equal_to : Literal [0 , 1 , 2 , 3 , 4 ] | None
455
455
456
- async def job_pagination_default_query_args (page : Page = 1 , after : datetime .datetime | None = None , desc : bool = False , not_started : bool = False , completed : bool = False , delayed : bool = False , failed : bool = False , retries_less_than : Literal [1 , 2 , 3 , 4 ] | None = None , retries_greater_than : Literal [0 , 1 , 2 , 3 ] | None = None , retries_equal_to : Literal [0 , 1 , 2 , 3 , 4 ] | None = None ) -> JobPaginationDefaultQueryArgs :
456
+ async def job_pagination_default_query_args (page : Page = 1 , after : datetime .datetime | None = None , desc : bool = False , not_started : bool = True , completed : bool = True , delayed : bool = True , failed : bool = True , retries_less_than : Literal [1 , 2 , 3 , 4 ] | None = None , retries_greater_than : Literal [0 , 1 , 2 , 3 ] | None = None , retries_equal_to : Literal [0 , 1 , 2 , 3 , 4 ] | None = None ) -> JobPaginationDefaultQueryArgs :
457
457
return {
458
458
"page" : page ,
459
459
"after" : after ,
@@ -475,7 +475,7 @@ def apply_job_filtering(query_params: JobPaginationDefaultQueryArgs, is_count_qu
475
475
def apply_job_filtering (query_params : JobPaginationDefaultQueryArgs , is_count_query : Literal [False ], / ) -> sqlalchemy .Select [tuple [Job ]]: ...
476
476
def apply_job_filtering (query_params : JobPaginationDefaultQueryArgs , is_count_query : bool = False , / ) -> sqlalchemy .Select :
477
477
in_statement = select (sqlalchemy .func .count (Job .id ) if is_count_query else Job )
478
- if [ query_params ["not_started" ], query_params ["completed" ], query_params ["delayed" ], query_params ["failed" ]]. count ( True ) != 4 :
478
+ if len ({ query_params ["not_started" ], query_params ["completed" ], query_params ["delayed" ], query_params ["failed" ]} ) != 1 : # If they are all the same, we can take a shortcut and not apply anything
479
479
# If all 4 are given, we can take a shortcut and not apply anything
480
480
if query_params ["not_started" ]:
481
481
in_statement = in_statement .where ((Job .completed == None ) & (Job .failed == None ) & (Job .delayed_until == None ))
0 commit comments