Replace status_id with in_progress boolean across mobile apps
- Remove TaskStatus model and status_id foreign key references - Add in_progress boolean field to task models and forms - Update TaskApi to use dedicated POST endpoints for task actions: - POST /tasks/:id/cancel/ instead of PATCH with is_cancelled - POST /tasks/:id/uncancel/ - POST /tasks/:id/archive/ - POST /tasks/:id/unarchive/ - Fix iOS TaskViewModel to use error-first pattern for Kotlin-Swift generic type bridging issues - Update iOS callback signatures to pass full TaskResponse instead of just taskId to avoid stale closure lookups - Add in_progress localization strings - Update widget preview data to use inProgress boolean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -64,14 +64,15 @@ class CacheManager {
|
||||
let title: String
|
||||
let description: String?
|
||||
let priority: String?
|
||||
let status: String?
|
||||
let inProgress: Bool
|
||||
let dueDate: String?
|
||||
let category: String?
|
||||
let residenceName: String?
|
||||
let isOverdue: Bool
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, title, description, priority, status, category
|
||||
case id, title, description, priority, category
|
||||
case inProgress = "in_progress"
|
||||
case dueDate = "due_date"
|
||||
case residenceName = "residence_name"
|
||||
case isOverdue = "is_overdue"
|
||||
@@ -126,12 +127,11 @@ class CacheManager {
|
||||
static func getUpcomingTasks() -> [CustomTask] {
|
||||
let allTasks = getData()
|
||||
|
||||
// Filter for pending/in-progress tasks, sorted by due date
|
||||
// Filter for actionable tasks (not completed, including in-progress and overdue)
|
||||
// Also exclude tasks that are pending completion via widget
|
||||
let upcoming = allTasks.filter { task in
|
||||
let status = task.status?.lowercased() ?? ""
|
||||
let isActive = status == "pending" || status == "in_progress" || status == "in progress"
|
||||
return isActive && task.shouldShow
|
||||
// Include if: not pending completion
|
||||
return task.shouldShow
|
||||
}
|
||||
|
||||
// Sort by due date (earliest first), with overdue at top
|
||||
@@ -444,6 +444,10 @@ struct InteractiveTaskRowView: View {
|
||||
}
|
||||
|
||||
private var priorityColor: Color {
|
||||
// Overdue tasks are always red
|
||||
if task.isOverdue {
|
||||
return .red
|
||||
}
|
||||
switch task.priority?.lowercased() {
|
||||
case "urgent": return .red
|
||||
case "high": return .orange
|
||||
@@ -565,6 +569,10 @@ struct LargeInteractiveTaskRowView: View {
|
||||
}
|
||||
|
||||
private var priorityColor: Color {
|
||||
// Overdue tasks are always red
|
||||
if task.isOverdue {
|
||||
return .red
|
||||
}
|
||||
switch task.priority?.lowercased() {
|
||||
case "urgent": return .red
|
||||
case "high": return .orange
|
||||
@@ -601,7 +609,7 @@ struct Casera: Widget {
|
||||
title: "Fix leaky faucet",
|
||||
description: "Kitchen sink needs repair",
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-15",
|
||||
category: "plumbing",
|
||||
residenceName: "Home",
|
||||
@@ -612,7 +620,7 @@ struct Casera: Widget {
|
||||
title: "Paint living room",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-20",
|
||||
category: "painting",
|
||||
residenceName: "Home",
|
||||
@@ -632,7 +640,7 @@ struct Casera: Widget {
|
||||
title: "Fix leaky faucet",
|
||||
description: nil,
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-15",
|
||||
category: "plumbing",
|
||||
residenceName: "Home",
|
||||
@@ -643,7 +651,7 @@ struct Casera: Widget {
|
||||
title: "Paint living room",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-20",
|
||||
category: "painting",
|
||||
residenceName: "Home",
|
||||
@@ -654,7 +662,7 @@ struct Casera: Widget {
|
||||
title: "Clean gutters",
|
||||
description: nil,
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-25",
|
||||
category: "maintenance",
|
||||
residenceName: "Home",
|
||||
@@ -684,7 +692,7 @@ struct Casera: Widget {
|
||||
title: "Fix leaky faucet",
|
||||
description: "Kitchen sink needs repair",
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-15",
|
||||
category: "plumbing",
|
||||
residenceName: "Home",
|
||||
@@ -695,7 +703,7 @@ struct Casera: Widget {
|
||||
title: "Paint living room",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "in_progress",
|
||||
inProgress: true,
|
||||
dueDate: "2024-12-20",
|
||||
category: "painting",
|
||||
residenceName: "Cabin",
|
||||
@@ -706,7 +714,7 @@ struct Casera: Widget {
|
||||
title: "Clean gutters",
|
||||
description: "Remove debris",
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-25",
|
||||
category: "maintenance",
|
||||
residenceName: "Home",
|
||||
@@ -726,7 +734,7 @@ struct Casera: Widget {
|
||||
title: "Fix leaky faucet",
|
||||
description: nil,
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -737,7 +745,7 @@ struct Casera: Widget {
|
||||
title: "Paint living room",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -748,7 +756,7 @@ struct Casera: Widget {
|
||||
title: "Clean gutters",
|
||||
description: nil,
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -759,7 +767,7 @@ struct Casera: Widget {
|
||||
title: "Replace HVAC filter",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -770,7 +778,7 @@ struct Casera: Widget {
|
||||
title: "Check smoke detectors",
|
||||
description: nil,
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -800,7 +808,7 @@ struct Casera: Widget {
|
||||
title: "Fix leaky faucet in kitchen",
|
||||
description: "Kitchen sink needs repair",
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-15",
|
||||
category: "plumbing",
|
||||
residenceName: "Home",
|
||||
@@ -811,7 +819,7 @@ struct Casera: Widget {
|
||||
title: "Paint living room walls",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "in_progress",
|
||||
inProgress: true,
|
||||
dueDate: "2024-12-20",
|
||||
category: "painting",
|
||||
residenceName: "Cabin",
|
||||
@@ -822,7 +830,7 @@ struct Casera: Widget {
|
||||
title: "Clean gutters",
|
||||
description: "Remove debris",
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-25",
|
||||
category: "maintenance",
|
||||
residenceName: "Home",
|
||||
@@ -833,7 +841,7 @@ struct Casera: Widget {
|
||||
title: "Replace HVAC filter",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-28",
|
||||
category: "hvac",
|
||||
residenceName: "Beach House",
|
||||
@@ -844,7 +852,7 @@ struct Casera: Widget {
|
||||
title: "Check smoke detectors",
|
||||
description: "Replace batteries if needed",
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2024-12-30",
|
||||
category: "safety",
|
||||
residenceName: "Home",
|
||||
@@ -855,7 +863,7 @@ struct Casera: Widget {
|
||||
title: "Service water heater",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2025-01-05",
|
||||
category: "plumbing",
|
||||
residenceName: "Cabin",
|
||||
@@ -866,7 +874,7 @@ struct Casera: Widget {
|
||||
title: "Inspect roof shingles",
|
||||
description: nil,
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2025-01-10",
|
||||
category: "exterior",
|
||||
residenceName: "Home",
|
||||
@@ -877,7 +885,7 @@ struct Casera: Widget {
|
||||
title: "Clean dryer vent",
|
||||
description: "Fire hazard prevention",
|
||||
priority: "urgent",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: "2025-01-12",
|
||||
category: "appliances",
|
||||
residenceName: "Beach House",
|
||||
@@ -897,7 +905,7 @@ struct Casera: Widget {
|
||||
title: "Task 1",
|
||||
description: nil,
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -908,7 +916,7 @@ struct Casera: Widget {
|
||||
title: "Task 2",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -919,7 +927,7 @@ struct Casera: Widget {
|
||||
title: "Task 3",
|
||||
description: nil,
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -930,7 +938,7 @@ struct Casera: Widget {
|
||||
title: "Task 4",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -941,7 +949,7 @@ struct Casera: Widget {
|
||||
title: "Task 5",
|
||||
description: nil,
|
||||
priority: "high",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -952,7 +960,7 @@ struct Casera: Widget {
|
||||
title: "Task 6",
|
||||
description: nil,
|
||||
priority: "low",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
@@ -963,7 +971,7 @@ struct Casera: Widget {
|
||||
title: "Task 7",
|
||||
description: nil,
|
||||
priority: "medium",
|
||||
status: "pending",
|
||||
inProgress: false,
|
||||
dueDate: nil,
|
||||
category: nil,
|
||||
residenceName: nil,
|
||||
|
||||
Reference in New Issue
Block a user