Merge branch 'master' of github.com:akatreyt/Planttime
This commit is contained in:
@@ -290,8 +290,16 @@ final class PlantDetailViewModel {
|
||||
|
||||
// Find and update the task
|
||||
if let index = schedule.tasks.firstIndex(where: { $0.id == task.id }) {
|
||||
schedule.tasks[index] = task.completed()
|
||||
let completedTask = task.completed()
|
||||
schedule.tasks[index] = completedTask
|
||||
careSchedule = schedule
|
||||
|
||||
// Persist the change to the repository
|
||||
do {
|
||||
try await careScheduleRepository.updateTask(completedTask)
|
||||
} catch {
|
||||
print("Failed to persist task completion: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,9 @@ struct TodayView: View {
|
||||
.task {
|
||||
await viewModel.loadTasks()
|
||||
}
|
||||
.onAppear {
|
||||
Task { await viewModel.loadTasks() }
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.loadTasks()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user