hopefully fix issue where voting is filled in with missing when its time to vote

This commit is contained in:
Trey t
2022-03-05 11:28:29 -06:00
parent 012fcc43d5
commit d56e74053e
13 changed files with 168 additions and 105 deletions

View File

@@ -19,4 +19,14 @@ extension PersistenceController {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
func deleteLast(numberOfEntries: Int) {
let entries = PersistenceController.shared.getData(startDate: Calendar.current.date(byAdding: .day, value: -numberOfEntries, to: Date())!,
endDate: Date(),
includedDays: [])
for entry in entries {
viewContext.delete(entry)
}
try! viewContext.save()
}
}