fix: resolve issue #13 - Today tab

Automated fix by Tony CI.
Closes #13

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
treyt
2026-02-16 22:33:31 -06:00
parent fef9552b22
commit 064d73ba03
2 changed files with 12 additions and 1 deletions

View File

@@ -285,8 +285,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)")
}
}
}

View File

@@ -77,6 +77,9 @@ struct TodayView: View {
.task {
await viewModel.loadTasks()
}
.onAppear {
Task { await viewModel.loadTasks() }
}
.refreshable {
await viewModel.loadTasks()
}