()
| 68 | * This keeps the Education/Explorer UI aligned with the actual implementation. |
| 69 | */ |
| 70 | export function getOrderedAlgorithmDetails(): AlgorithmDetail[] { |
| 71 | const byId = new Map<number, AlgorithmDetail>(algorithmDetails.map((d) => [d.id, d])); |
| 72 | |
| 73 | return algorithms.map((meta) => { |
| 74 | const existing = byId.get(meta.id); |
| 75 | if (existing) { |
| 76 | const technicalSummary = getAlgorithmTechnicalSummary(meta.id); |
| 77 | const merged = technicalSummary ? { ...existing, technicalSummary } : existing; |
| 78 | // Ensure name/category stay consistent with the registry. |
| 79 | if (merged.name !== meta.name || merged.category !== meta.category) { |
| 80 | return { ...merged, name: meta.name, category: meta.category }; |
| 81 | } |
| 82 | return merged; |
| 83 | } |
| 84 | |
| 85 | // Fallback: registry algorithm exists but has no long-form info entry yet. |
| 86 | return { |
| 87 | id: meta.id, |
| 88 | name: meta.name, |
| 89 | category: meta.category, |
| 90 | overview: "", |
| 91 | characteristics: [], |
| 92 | artifacts: [], |
| 93 | bestFor: [], |
| 94 | complexity: "O(N)", |
| 95 | }; |
| 96 | }); |
| 97 | } |
| 98 | |
| 99 | export const getAlgorithmDetail = (id: number) => getOrderedAlgorithmDetails().find((a) => a.id === id); |
no test coverage detected