Explorar el Código

Save 120 days

Jon Mårtensson hace 3 años
padre
commit
f6a16ec35f
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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.transaction { storage in
                     storage.append(dailystat, to: file, uniqBy: \.id)
                     storage.append(dailystat, to: file, uniqBy: \.id)
                     newEntries = storage.retrieve(file, as: [DailyStats].self)?
                     newEntries = storage.retrieve(file, as: [DailyStats].self)?
-                        .filter { $0.date.addingTimeInterval(1.days.timeInterval) < now }
                         .sorted { $0.date > $1.date } ?? []
                         .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)
                     storage.save(Array(newEntries), as: file)
                 }
                 }
             }
             }