(data *reportData, outFile *os.File)
| 134 | } |
| 135 | |
| 136 | func outputReportJSON(data *reportData, outFile *os.File) error { |
| 137 | type reportJSON struct { |
| 138 | Summary any `json:"summary"` |
| 139 | Groups []board.JSONGroup `json:"groups"` |
| 140 | GroupBy string `json:"group_by"` |
| 141 | CriticalPath []ReportTaskJSON `json:"critical_path"` |
| 142 | BlockedTasks []ReportTaskJSON `json:"blocked_tasks"` |
| 143 | Graph map[string]any `json:"graph,omitempty"` |
| 144 | } |
| 145 | |
| 146 | cpTasks := make([]ReportTaskJSON, len(data.CriticalPath)) |
| 147 | for i, t := range data.CriticalPath { |
| 148 | cpTasks[i] = taskToReportJSON(t) |
| 149 | } |
| 150 | |
| 151 | blockedTasks := make([]ReportTaskJSON, len(data.BlockedTasks)) |
| 152 | for i, t := range data.BlockedTasks { |
| 153 | blockedTasks[i] = taskToReportJSON(t) |
| 154 | } |
| 155 | |
| 156 | rj := reportJSON{ |
| 157 | Summary: data.Metrics, |
| 158 | Groups: board.ToJSON(data.GroupedTasks), |
| 159 | GroupBy: data.GroupBy, |
| 160 | CriticalPath: cpTasks, |
| 161 | BlockedTasks: blockedTasks, |
| 162 | } |
| 163 | |
| 164 | if data.IncludeGraph { |
| 165 | rj.Graph = data.GraphJSON |
| 166 | } |
| 167 | |
| 168 | return WriteJSON(outFile, rj) |
| 169 | } |
no test coverage detected