Skip to content

Commit

Permalink
black refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Valimp committed May 15, 2024
1 parent 67d5697 commit a2fa015
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,13 @@ def get_tickets(
if type_:
where_clause.append(TicketModel.type == type_)
if reason:
subquery = (
FlagModel.select(FlagModel.ticket_id)
.where(FlagModel.reason == reason)
subquery = FlagModel.select(FlagModel.ticket_id).where(
FlagModel.reason == reason
)
where_clause.append(TicketModel.id.in_(subquery))

# Get the total number of tickets with the specified filters
count = (
TicketModel.select()
.where(*where_clause)
.count()
)
count = TicketModel.select().where(*where_clause).count()
max_page = count // page_size + int(count % page_size != 0)
if page > max_page:
return {"tickets": [], "max_page": max_page}
Expand Down

0 comments on commit a2fa015

Please sign in to comment.