sort mixes by created date

+ write og mix date to track mix
This commit is contained in:
cwilvx
2024-12-27 10:40:27 +03:00
parent 883c845d45
commit 872fdf26b4
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -498,9 +498,13 @@ class MixTable(Base):
@classmethod @classmethod
def get_all(cls, with_userid: bool = False): def get_all(cls, with_userid: bool = False):
if with_userid: if with_userid:
result = cls.execute(select(cls).where(cls.userid == get_current_userid())) result = cls.execute(
select(cls)
.where(cls.userid == get_current_userid())
.order_by(cls.timestamp.desc())
)
else: else:
result = cls.execute(select(cls)) result = cls.execute(select(cls).order_by(cls.timestamp.desc()))
return Mix.mixes_to_dataclasses(result.fetchall()) return Mix.mixes_to_dataclasses(result.fetchall())
+1
View File
@@ -475,6 +475,7 @@ class MixesPlugin(Plugin):
"albums": None, "albums": None,
}, },
) )
trackmix.timestamp = mix.timestamp
# INFO: Write track mix save state # INFO: Write track mix save state
if mix.extra.get("trackmix_saved"): if mix.extra.get("trackmix_saved"):