buildDependencyInfo resolves depends-on and blocks lists for a task.
(task *model.Task, allTasks []*model.Task)
| 355 | |
| 356 | // buildDependencyInfo resolves depends-on and blocks lists for a task. |
| 357 | func buildDependencyInfo(task *model.Task, allTasks []*model.Task) dependencyInfo { |
| 358 | taskMap := buildTaskMap(allTasks) |
| 359 | g := graph.NewGraph(allTasks) |
| 360 | |
| 361 | var info dependencyInfo |
| 362 | for _, depID := range task.Dependencies { |
| 363 | entry := depEntry{ID: depID} |
| 364 | if dep, ok := taskMap[depID]; ok { |
| 365 | entry.Title = dep.Title |
| 366 | } |
| 367 | info.DependsOn = append(info.DependsOn, entry) |
| 368 | } |
| 369 | for _, blockedID := range g.Adjacency[task.ID] { |
| 370 | entry := depEntry{ID: blockedID} |
| 371 | if dep, ok := taskMap[blockedID]; ok { |
| 372 | entry.Title = dep.Title |
| 373 | } |
| 374 | info.Blocks = append(info.Blocks, entry) |
| 375 | } |
| 376 | if task.Parent != "" { |
| 377 | entry := depEntry{ID: task.Parent} |
| 378 | if p, ok := taskMap[task.Parent]; ok { |
| 379 | entry.Title = p.Title |
| 380 | } |
| 381 | info.Parent = &entry |
| 382 | } |
| 383 | for _, t := range allTasks { |
| 384 | if t.Parent == task.ID { |
| 385 | entry := depEntry{ID: t.ID, Title: t.Title, Status: string(t.Status)} |
| 386 | info.Children = append(info.Children, entry) |
| 387 | } |
| 388 | } |
| 389 | return info |
| 390 | } |
| 391 | |
| 392 | // outputGet routes to the appropriate formatter. |
| 393 | func outputGet(task *model.Task, deps dependencyInfo, ctxFiles []taskcontext.FileEntry, wl *worklogInfo, format string) error { |
no test coverage detected