fixed issue when adding multiple missing entries
This commit is contained in:
@@ -11,6 +11,7 @@ enum EntryType: Int {
|
||||
case notification
|
||||
case header
|
||||
case listView
|
||||
case filledInMissing
|
||||
}
|
||||
|
||||
extension MoodEntry {
|
||||
|
||||
@@ -56,7 +56,10 @@ extension PersistenceController {
|
||||
let existingEntriesSet = Set(existingEntries)
|
||||
let missing = Array(allDatesSet.subtracting(existingEntriesSet)).sorted(by: >)
|
||||
for date in missing {
|
||||
add(mood: .missing, forDate: date, entryType: .listView)
|
||||
// add 12 hours, if you enter a things right at 12:00.00 it wont show .... mabye
|
||||
// due to utc offset?
|
||||
let adjustedDate = Calendar.current.date(byAdding: .hour, value: 12, to: date)!
|
||||
add(mood: .missing, forDate: adjustedDate, entryType: .filledInMissing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ struct ContentView: View {
|
||||
}
|
||||
|
||||
if let selectedEntry = selectedEntry,
|
||||
deleteEnabled{
|
||||
deleteEnabled,
|
||||
selectedEntry.mood != .missing {
|
||||
Button(String(localized: "content_view_delete_entry"), action: {
|
||||
viewModel.update(entry: selectedEntry, toMood: Mood.missing)
|
||||
showUpdateEntryAlert = false
|
||||
|
||||
Reference in New Issue
Block a user