summaryrefslogtreecommitdiff
path: root/internal/handlers/atoms.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/atoms.go')
-rw-r--r--internal/handlers/atoms.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/handlers/atoms.go b/internal/handlers/atoms.go
index 0ebf4e6..e99c879 100644
--- a/internal/handlers/atoms.go
+++ b/internal/handlers/atoms.go
@@ -1,13 +1,14 @@
package handlers
import (
+ "log"
"sort"
"task-dashboard/internal/models"
"task-dashboard/internal/store"
)
-// BuildUnifiedAtomList creates a list of atoms from tasks and cards
+// BuildUnifiedAtomList creates a list of atoms from tasks, cards, and google tasks
func BuildUnifiedAtomList(s *store.Store) ([]models.Atom, []models.Board, error) {
tasks, err := s.GetTasks()
if err != nil {
@@ -19,7 +20,13 @@ func BuildUnifiedAtomList(s *store.Store) ([]models.Atom, []models.Board, error)
return nil, nil, err
}
- atoms := make([]models.Atom, 0, len(tasks))
+ gTasks, err := s.GetGoogleTasks()
+ if err != nil {
+ // Log but don't fail if gtasks fails (might be new/not configured)
+ log.Printf("Warning: failed to fetch cached google tasks: %v", err)
+ }
+
+ atoms := make([]models.Atom, 0, len(tasks)+len(gTasks))
// Add incomplete tasks
for _, task := range tasks {
@@ -28,6 +35,13 @@ func BuildUnifiedAtomList(s *store.Store) ([]models.Atom, []models.Board, error)
}
}
+ // Add incomplete google tasks
+ for _, gTask := range gTasks {
+ if !gTask.Completed {
+ atoms = append(atoms, models.GoogleTaskToAtom(gTask))
+ }
+ }
+
// Add cards with due dates or from actionable lists
for _, board := range boards {
for _, card := range board.Cards {