(value: EffortValue)
| 200 | } |
| 201 | |
| 202 | export function convertEffortValueToLevel(value: EffortValue): EffortLevel { |
| 203 | if (typeof value === 'string') { |
| 204 | // Runtime guard: value may come from remote config (GrowthBook) where |
| 205 | // TypeScript types can't help us. Coerce unknown strings to 'high' |
| 206 | // rather than passing them through unchecked. |
| 207 | return isEffortLevel(value) ? value : 'high' |
| 208 | } |
| 209 | if (process.env.USER_TYPE === 'ant' && typeof value === 'number') { |
| 210 | if (value <= 50) return 'low' |
| 211 | if (value <= 85) return 'medium' |
| 212 | if (value <= 100) return 'high' |
| 213 | return 'max' |
| 214 | } |
| 215 | return 'high' |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Get user-facing description for effort levels |
no test coverage detected