Merge pull request #15 from akatreyt/fix/issue-13

fix: resolve #13 - Today tab
This commit is contained in:
akatreyt
2026-02-16 22:34:24 -06:00
committed by GitHub
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()
}