chore(deps): auto fix by pre-commit hooks
This commit is contained in:
committed by
MingxuanGame
parent
b4fd4e0256
commit
7625cd99f5
@@ -56,20 +56,22 @@ async def get_all_rooms(
|
||||
db_category = category
|
||||
where_clauses: list[ColumnElement[bool]] = [col(Room.category) == db_category]
|
||||
now = utcnow()
|
||||
|
||||
|
||||
if status is not None:
|
||||
where_clauses.append(col(Room.status) == status)
|
||||
#print(mode, category, status, current_user.id)
|
||||
# print(mode, category, status, current_user.id)
|
||||
if mode == "open":
|
||||
# 修改为新的查询逻辑:状态为 idle 或 playing,starts_at 不为空,ends_at 为空
|
||||
where_clauses.extend([
|
||||
col(Room.status).in_([RoomStatus.IDLE, RoomStatus.PLAYING]),
|
||||
col(Room.starts_at).is_not(None),
|
||||
col(Room.ends_at).is_(None)
|
||||
])
|
||||
#if category == RoomCategory.REALTIME:
|
||||
where_clauses.extend(
|
||||
[
|
||||
col(Room.status).in_([RoomStatus.IDLE, RoomStatus.PLAYING]),
|
||||
col(Room.starts_at).is_not(None),
|
||||
col(Room.ends_at).is_(None),
|
||||
]
|
||||
)
|
||||
# if category == RoomCategory.REALTIME:
|
||||
# where_clauses.append(col(Room.id).in_(MultiplayerHubs.rooms.keys()))
|
||||
|
||||
|
||||
if mode == "participated":
|
||||
where_clauses.append(
|
||||
exists().where(
|
||||
@@ -77,10 +79,10 @@ async def get_all_rooms(
|
||||
col(RoomParticipatedUser.user_id) == current_user.id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if mode == "owned":
|
||||
where_clauses.append(col(Room.host_id) == current_user.id)
|
||||
|
||||
|
||||
if mode == "ended":
|
||||
where_clauses.append((col(Room.ends_at).is_not(None)) & (col(Room.ends_at) < now.replace(tzinfo=UTC)))
|
||||
|
||||
@@ -96,7 +98,7 @@ async def get_all_rooms(
|
||||
.unique()
|
||||
.all()
|
||||
)
|
||||
#print("Retrieved rooms:", db_rooms)
|
||||
# print("Retrieved rooms:", db_rooms)
|
||||
for room in db_rooms:
|
||||
resp = await RoomResp.from_db(room, db)
|
||||
resp.has_password = bool((room.password or "").strip())
|
||||
@@ -424,4 +426,4 @@ async def get_room_events(
|
||||
playlist_items=playlist_items_resps,
|
||||
room=room_resp,
|
||||
user=user_resps,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user