( task *model.Task, childrenIndex map[string][]*model.Task, tasksByID map[string]*model.Task, )
| 240 | } |
| 241 | |
| 242 | func buildStatusOutputFromTask( |
| 243 | task *model.Task, |
| 244 | childrenIndex map[string][]*model.Task, |
| 245 | tasksByID map[string]*model.Task, |
| 246 | ) statusOutput { |
| 247 | created := "" |
| 248 | if !task.Created.IsZero() { |
| 249 | created = task.Created.Format("2006-01-02") |
| 250 | } |
| 251 | out := statusOutput{ |
| 252 | ID: task.ID, |
| 253 | Title: task.Title, |
| 254 | Status: string(task.Status), |
| 255 | Priority: string(task.Priority), |
| 256 | Effort: string(task.Effort), |
| 257 | Tags: task.Tags, |
| 258 | Owner: task.Owner, |
| 259 | Parent: task.Parent, |
| 260 | Created: created, |
| 261 | Dependencies: task.Dependencies, |
| 262 | Group: task.Group, |
| 263 | FilePath: task.FilePath, |
| 264 | } |
| 265 | if len(task.Dependencies) > 0 { |
| 266 | out.BlockedBy = resolveBlockingDeps(task.Dependencies, tasksByID) |
| 267 | blocked := len(out.BlockedBy) > 0 |
| 268 | out.Blocked = &blocked |
| 269 | if !blocked { |
| 270 | out.BlockedBy = nil |
| 271 | } |
| 272 | } |
| 273 | if childrenIndex != nil { |
| 274 | out.Children = collectChildrenTree(task.ID, childrenIndex, map[string]bool{task.ID: true}) |
| 275 | } |
| 276 | return out |
| 277 | } |
| 278 | |
| 279 | func resolveBlockingDeps(deps []string, tasksByID map[string]*model.Task) []string { |
| 280 | var blocking []string |
no test coverage detected