fix issue with two votes on the same date
fix issue with header not showing correct vote date split logic for Persistence into different files create class that deals with voting time, existing votes, and what should be shown based on that
This commit is contained in:
@@ -91,8 +91,7 @@ struct ContentView: View {
|
||||
}
|
||||
|
||||
if let selectedEntry = selectedEntry,
|
||||
deleteEnabled,
|
||||
selectedEntry.mood != .missing {
|
||||
deleteEnabled{
|
||||
Button(String(localized: "content_view_delete_entry"), action: {
|
||||
viewModel.update(entry: selectedEntry, toMood: Mood.missing)
|
||||
showUpdateEntryAlert = false
|
||||
@@ -140,7 +139,11 @@ struct ContentView: View {
|
||||
return ""
|
||||
}
|
||||
|
||||
let components = Calendar.current.dateComponents([.day, .month, .year], from: entry.forDate!)
|
||||
guard let forDate = entry.forDate else {
|
||||
return ""
|
||||
}
|
||||
|
||||
let components = Calendar.current.dateComponents([.day, .month, .year], from: forDate)
|
||||
// let day = components.day!
|
||||
let month = components.month!
|
||||
let year = components.year!
|
||||
@@ -178,7 +181,7 @@ struct ContentView: View {
|
||||
|
||||
private var headerView: some View {
|
||||
VStack {
|
||||
if viewModel.shouldShowVotingHeader() {
|
||||
if ShowBasedOnVoteLogics.isMissingCurrentVote() {
|
||||
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
|
||||
withAnimation {
|
||||
viewModel.add(mood: mood, forDate: date, entryType: .header)
|
||||
|
||||
Reference in New Issue
Block a user