Update main.py
This commit is contained in:
parent
a7bfcaaff1
commit
b445957e3c
10
main.py
10
main.py
@ -1375,6 +1375,8 @@ async def v1_players_get_random(
|
||||
final_players = []
|
||||
p_list = [x.upper() for x in pos_exc]
|
||||
for x in all_players:
|
||||
if limit is not None and len(final_players) >= limit:
|
||||
break
|
||||
if not set(p_list).intersection(x.get_all_pos()):
|
||||
final_players.append(x)
|
||||
else:
|
||||
@ -2566,10 +2568,6 @@ async def v1_events_get(
|
||||
csv: Optional[bool] = None):
|
||||
all_events = Event.select()
|
||||
|
||||
if all_events.count() == 0:
|
||||
db.close()
|
||||
raise HTTPException(status_code=404, detail=f'There are no events to filter')
|
||||
|
||||
if name is not None:
|
||||
all_events = all_events.where(fn.Lower(Event.name) == name.lower())
|
||||
if in_desc is not None:
|
||||
@ -2580,10 +2578,6 @@ async def v1_events_get(
|
||||
if active is not None:
|
||||
all_events = all_events.where(Event.active == active)
|
||||
|
||||
if all_events.count() == 0:
|
||||
db.close()
|
||||
raise HTTPException(status_code=404, detail=f'No events found')
|
||||
|
||||
if csv:
|
||||
data_list = [['id', 'name', 'short_desc', 'long_desc', 'url', 'thumbnail', 'active']]
|
||||
for line in all_events:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user