diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 11:56:29 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 11:56:29 -1000 |
| commit | ec8a9c0ea46dec7d26caa763e3adefcaf3fc7552 (patch) | |
| tree | 1f91bbc7ec87314189a441c53b7c3b25f1817db0 /internal/api | |
| parent | 83beddfab9584ae4b64a782c978236472b6d5745 (diff) | |
Fix bugs and add bug management scripts
Bug fixes:
- #36: Hide recurring tasks until due day (add IsRecurring to Task/Atom)
- Trello cards missing: change filter=visible to filter=open
- Build fix: add missing fmt import in atom.go
Infrastructure:
- Add scripts/bugs and scripts/resolve-bug for DB bug tracking
- Remove issues/ directory (bugs now tracked in DB)
- Add timeline_logic_test.go
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/todoist.go | 29 | ||||
| -rw-r--r-- | internal/api/todoist_test.go | 12 | ||||
| -rw-r--r-- | internal/api/trello.go | 8 |
3 files changed, 25 insertions, 24 deletions
diff --git a/internal/api/todoist.go b/internal/api/todoist.go index 6c998cf..2c94e08 100644 --- a/internal/api/todoist.go +++ b/internal/api/todoist.go @@ -41,11 +41,8 @@ type todoistTaskResponse struct { ProjectID string `json:"project_id"` Priority int `json:"priority"` Labels []string `json:"labels"` - Due *struct { - Date string `json:"date"` - Datetime string `json:"datetime"` - } `json:"due"` - URL string `json:"url"` + Due *dueInfo `json:"due"` + URL string `json:"url"` CreatedAt string `json:"created_at"` } @@ -73,11 +70,8 @@ type SyncItemResponse struct { ProjectID string `json:"project_id"` Priority int `json:"priority"` Labels []string `json:"labels"` - Due *struct { - Date string `json:"date"` - Datetime string `json:"datetime"` - } `json:"due"` - IsCompleted bool `json:"is_completed"` + Due *dueInfo `json:"due"` + IsCompleted bool `json:"is_completed"` IsDeleted bool `json:"is_deleted"` AddedAt string `json:"added_at"` } @@ -125,6 +119,9 @@ func (c *TodoistClient) GetTasks(ctx context.Context) ([]models.Task, error) { } task.DueDate = parseDueDate(apiTask.Due) + if apiTask.Due != nil { + task.IsRecurring = apiTask.Due.IsRecurring + } tasks = append(tasks, task) } @@ -276,10 +273,14 @@ func (c *TodoistClient) ReopenTask(ctx context.Context, taskID string) error { } // parseDueDate parses due date from API response -func parseDueDate(due *struct { - Date string `json:"date"` - Datetime string `json:"datetime"` -}) *time.Time { +// dueInfo represents the due date structure from Todoist API +type dueInfo struct { + Date string `json:"date"` + Datetime string `json:"datetime"` + IsRecurring bool `json:"is_recurring"` +} + +func parseDueDate(due *dueInfo) *time.Time { if due == nil { return nil } diff --git a/internal/api/todoist_test.go b/internal/api/todoist_test.go index 88f94f8..2fa6e28 100644 --- a/internal/api/todoist_test.go +++ b/internal/api/todoist_test.go @@ -104,20 +104,16 @@ func TestTodoistClient_CreateTask_WithDueDate(t *testing.T) { } // Return mock response with due date - dueStruct := struct { - Date string `json:"date"` - Datetime string `json:"datetime"` - }{ - Date: "2026-01-15", - Datetime: "", - } response := todoistTaskResponse{ ID: "task-789", Content: "Task with Due Date", ProjectID: "project-456", URL: "https://todoist.com/task/789", CreatedAt: time.Now().Format(time.RFC3339), - Due: &dueStruct, + Due: &dueInfo{ + Date: "2026-01-15", + Datetime: "", + }, } w.Header().Set("Content-Type", "application/json") diff --git a/internal/api/trello.go b/internal/api/trello.go index 4cf7e9e..a19bbea 100644 --- a/internal/api/trello.go +++ b/internal/api/trello.go @@ -86,7 +86,7 @@ func (c *TrelloClient) GetBoards(ctx context.Context) ([]models.Board, error) { // GetCards fetches all cards for a specific board func (c *TrelloClient) GetCards(ctx context.Context, boardID string) ([]models.Card, error) { params := c.authParams() - params.Set("filter", "visible") + params.Set("filter", "open") params.Set("fields", "id,name,idList,due,url,idBoard") var apiCards []trelloCardResponse @@ -95,7 +95,11 @@ func (c *TrelloClient) GetCards(ctx context.Context, boardID string) ([]models.C return nil, fmt.Errorf("failed to fetch cards: %w", err) } - log.Printf("Trello GetCards: board %s returned %d cards from API", boardID, len(apiCards)) + if len(apiCards) == 0 { + log.Printf("Trello GetCards: board %s returned 0 cards (may have only archived cards)", boardID) + } else { + log.Printf("Trello GetCards: board %s returned %d cards", boardID, len(apiCards)) + } // Fetch lists to get list names lists, err := c.getLists(ctx, boardID) |
