Browse Source

Save 120 days

Jon Mårtensson 3 years ago
parent
commit
f6a16ec35f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      FreeAPS/Sources/APS/APSManager.swift

+ 1 - 1
FreeAPS/Sources/APS/APSManager.swift

@@ -830,8 +830,8 @@ final class BaseAPSManager: APSManager, Injectable {
                 storage.transaction { storage in
                     storage.append(dailystat, to: file, uniqBy: \.id)
                     newEntries = storage.retrieve(file, as: [DailyStats].self)?
-                        .filter { $0.date.addingTimeInterval(1.days.timeInterval) < now }
                         .sorted { $0.date > $1.date } ?? []
+                        .filter { $0.date.addingTimeInterval(1.days.timeInterval) < now && $0.date.addingTimeInterval(120.days.timeInterval) > Date() }
                     storage.save(Array(newEntries), as: file)
                 }
             }