(steps)
| 226 | } |
| 227 | |
| 228 | function percentDone(steps) { |
| 229 | if (!steps.length) return 0; |
| 230 | let score = 0; |
| 231 | for (const s of steps) { |
| 232 | if (s.status === "done") score += 1; |
| 233 | else if (s.status === "in_progress") score += 0.5; |
| 234 | } |
| 235 | return Math.round((score / steps.length) * 100); |
| 236 | } |
| 237 | |
| 238 | // Rank a phase/section heading into the canonical modernization order so the UI |
| 239 | // can recommend (and gently gate) the sequence: assessment -> P0 -> P1 -> P2 -> |