mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-21 06:50:18 +00:00
fix(db): convert results to list before closing session
This commit is contained in:
parent
e948b6abea
commit
ca9576160f
@ -103,8 +103,8 @@ class Database(metaclass=Singleton):
|
|||||||
def get_packs(self):
|
def get_packs(self):
|
||||||
stmt = select(Pack)
|
stmt = select(Pack)
|
||||||
with self.sessionmaker() as session:
|
with self.sessionmaker() as session:
|
||||||
results = session.scalars(stmt)
|
results = list(session.scalars(stmt))
|
||||||
return list(results)
|
return results
|
||||||
|
|
||||||
def get_pack_by_id(self, pack_id: str):
|
def get_pack_by_id(self, pack_id: str):
|
||||||
stmt = select(Pack).where(Pack.id == pack_id)
|
stmt = select(Pack).where(Pack.id == pack_id)
|
||||||
@ -119,14 +119,14 @@ class Database(metaclass=Singleton):
|
|||||||
def get_charts_by_pack_id(self, pack_id: str):
|
def get_charts_by_pack_id(self, pack_id: str):
|
||||||
stmt = select(Chart).where(Chart.set == pack_id)
|
stmt = select(Chart).where(Chart.set == pack_id)
|
||||||
with self.sessionmaker() as session:
|
with self.sessionmaker() as session:
|
||||||
results = session.scalars(stmt)
|
results = list(session.scalars(stmt))
|
||||||
return list(results)
|
return results
|
||||||
|
|
||||||
def get_charts_by_song_id(self, song_id: str):
|
def get_charts_by_song_id(self, song_id: str):
|
||||||
stmt = select(Chart).where(Chart.song_id == song_id)
|
stmt = select(Chart).where(Chart.song_id == song_id)
|
||||||
with self.sessionmaker() as session:
|
with self.sessionmaker() as session:
|
||||||
results = session.scalars(stmt)
|
results = list(session.scalars(stmt))
|
||||||
return list(results)
|
return results
|
||||||
|
|
||||||
def get_chart(self, song_id: str, rating_class: int):
|
def get_chart(self, song_id: str, rating_class: int):
|
||||||
stmt = select(Chart).where(
|
stmt = select(Chart).where(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user