| 169 | return status; |
| 170 | } |
| 171 | |
| 172 | function phaseSummary(campaign) { |
| 173 | const phases = campaign.phases || []; |
| 174 | if (phases.length > 0) { |
| 175 | const incomplete = phases.find((phase) => !/^(complete|completed|done)$/i.test(phase.status)); |
| 176 | const current = incomplete ? incomplete.number : phases.length; |
| 177 | return { |
| 178 | current, |
| 179 | total: phases.length, |
| 180 | label: `Phase ${current}/${phases.length}`, |
| 181 | }; |
| 182 | } |
| 183 | |
| 184 | const total = Number(campaign.frontmatter.phase_count || 0); |
| 185 | const current = Number(campaign.frontmatter.current_phase || 0); |
| 186 | if (total > 0 && current > 0) { |
| 187 | return { current, total, label: `Phase ${current}/${total}` }; |
| 188 | } |
| 189 | |
| 190 | return { current: 0, total: 0, label: 'No phase table' }; |
| 191 | } |
| 192 | |
| 193 | function lastDecision(content) { |