MCPcopy Create free account
hub / github.com/driangle/taskmd / groupSnapshots

Function groupSnapshots

apps/cli/internal/cli/snapshot_analysis.go:26–52  ·  view source on GitHub ↗

groupSnapshots groups snapshots by a field

(snapshots []TaskSnapshot, groupBy string)

Source from the content-addressed store, hash-verified

24
25// groupSnapshots groups snapshots by a field
26func groupSnapshots(snapshots []TaskSnapshot, groupBy string) map[string][]TaskSnapshot {
27 groups := make(map[string][]TaskSnapshot)
28
29 for _, snapshot := range snapshots {
30 var key string
31 switch groupBy {
32 case "status":
33 key = snapshot.Status
34 case "priority":
35 key = snapshot.Priority
36 case "effort":
37 key = snapshot.Effort
38 case "group":
39 key = snapshot.Group
40 default:
41 key = "ungrouped"
42 }
43
44 if key == "" {
45 key = "none"
46 }
47
48 groups[key] = append(groups[key], snapshot)
49 }
50
51 return groups
52}
53
54// calculateDepthMap calculates dependency depth for each task
55func calculateDepthMap(tasks []*model.Task, taskMap map[string]*model.Task) map[string]int {

Callers 3

runSnapshotFunction · 0.85
outputSnapshotMarkdownFunction · 0.85
TestGroupSnapshotsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGroupSnapshotsFunction · 0.68