Remove remaining status_id references after in_progress migration
- Remove Preload("Status") from worker handler and repositories
- Update seeds to use in_progress boolean instead of status_id
- Remove task_taskstatus table creation from lookup seeds
- Update documentation to reflect in_progress boolean pattern
Fixes notification worker error:
"Status: unsupported relations for schema Task"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -82,14 +82,14 @@ if task.NextDueDate == nil && len(task.Completions) > 0 {
|
||||
|
||||
**Handler**: `InProgressHandler`
|
||||
|
||||
**Condition**: `task.Status != nil && task.Status.Name == "In Progress"`
|
||||
**Condition**: `task.InProgress == true`
|
||||
|
||||
**Result**: `in_progress_tasks`
|
||||
|
||||
Tasks with the "In Progress" status are grouped together regardless of their due date. This allows users to see what's actively being worked on.
|
||||
Tasks marked as "In Progress" are grouped together regardless of their due date. This allows users to see what's actively being worked on.
|
||||
|
||||
```go
|
||||
if task.Status != nil && task.Status.Name == "In Progress" {
|
||||
if task.InProgress {
|
||||
return "in_progress_tasks"
|
||||
}
|
||||
```
|
||||
@@ -188,15 +188,14 @@ return "upcoming_tasks"
|
||||
This is by design - "In Progress" indicates active work, so the task should be visible there. However, this means:
|
||||
|
||||
1. If a recurring task is marked "In Progress" and then completed
|
||||
2. The status MUST be reset to "Pending" after completion
|
||||
2. The `in_progress` flag MUST be reset to `false` after completion
|
||||
3. Otherwise, the task stays in "In Progress" instead of moving to "Upcoming"
|
||||
|
||||
This is handled automatically in `TaskService.CreateCompletion()`:
|
||||
|
||||
```go
|
||||
if isRecurringTask {
|
||||
pendingStatusID := uint(1)
|
||||
task.StatusID = &pendingStatusID
|
||||
task.InProgress = false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -246,8 +245,8 @@ Each column has associated metadata for UI rendering:
|
||||
import "github.com/treytartt/casera-api/internal/task/categorization"
|
||||
|
||||
task := &models.Task{
|
||||
DueDate: time.Now().AddDate(0, 0, 15), // 15 days from now
|
||||
Status: &models.TaskStatus{Name: "Pending"},
|
||||
DueDate: time.Now().AddDate(0, 0, 15), // 15 days from now
|
||||
InProgress: false,
|
||||
}
|
||||
|
||||
column := categorization.DetermineKanbanColumn(task, 30)
|
||||
@@ -291,14 +290,14 @@ Key test scenarios:
|
||||
|
||||
1. **Check `IsCancelled`**: Cancelled takes highest priority
|
||||
2. **Check `NextDueDate`**: For recurring tasks, this determines placement
|
||||
3. **Check `Status`**: "In Progress" overrides date-based categorization
|
||||
3. **Check `InProgress`**: `true` overrides date-based categorization
|
||||
4. **Check `Completions`**: Empty + nil NextDueDate = upcoming, not completed
|
||||
|
||||
### Recurring task not moving to Upcoming after completion?
|
||||
|
||||
Verify that `CreateCompletion` is:
|
||||
1. Setting `NextDueDate` correctly
|
||||
2. Resetting `StatusID` to Pending (1)
|
||||
2. Resetting `InProgress` to `false`
|
||||
|
||||
### Task showing overdue but due date looks correct?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user