Skip to content

Commit

Permalink
Fixed wrong backup sorting key, should be timestamp instead of backup id
Browse files Browse the repository at this point in the history
also fixed a comment typo
  • Loading branch information
Fallen-Breath committed Jan 2, 2024
1 parent 07cfa6f commit 5f7d324
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prime_backup/db/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def get_backup(self, backup_id: int) -> schema.Backup:

def get_backups(self, backup_ids: List[int]) -> Dict[int, schema.Backup]:
"""
:return: a dict, backup id -> optional Backup. All id hashes are in the dict
:return: a dict, backup id -> optional Backup. All given ids are in the dict
"""
result: Dict[int, Optional[schema.Backup]] = {bid: None for bid in backup_ids}
for view in collection_utils.slicing_iterate(backup_ids, self.__safe_var_limit):
Expand All @@ -416,7 +416,7 @@ def list_backup(self, backup_filter: Optional[BackupFilter] = None, limit: Optio
s = select(schema.Backup)
if backup_filter is not None:
s = self.__apply_backup_filter(s, backup_filter)
s = s.order_by(desc(schema.Backup.id))
s = s.order_by(desc(schema.Backup.timestamp), desc(schema.Backup.id))

if self.__needs_manual_backup_tag_filter(backup_filter):
backups = [backup for backup in self.session.execute(s).scalars().all() if self.__manual_backup_tag_filter(backup, backup_filter)]
Expand Down

0 comments on commit 5f7d324

Please sign in to comment.