(value: EffortValue)
| 236 | } |
| 237 | |
| 238 | export function convertEffortValueToLevel(value: EffortValue): EffortLevel { |
| 239 | if (typeof value === 'string') { |
| 240 | // Runtime guard: value may come from remote config (GrowthBook) where |
| 241 | // TypeScript types can't help us. Coerce unknown strings to 'high' |
| 242 | // rather than passing them through unchecked. |
| 243 | return isEffortLevel(value) ? value : 'high' |
| 244 | } |
| 245 | if (process.env.USER_TYPE === 'ant' && typeof value === 'number') { |
| 246 | if (value <= 50) return 'low' |
| 247 | if (value <= 85) return 'medium' |
| 248 | if (value <= 100) return 'high' |
| 249 | return 'max' |
| 250 | } |
| 251 | return 'high' |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Get user-facing description for effort levels |
no test coverage detected