-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Egor Berezovskiy <egor@berezify.fr>
- Loading branch information
Showing
2 changed files
with
15 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 3 additions & 14 deletions
17
front/src/applications/stdcm/utils/maxSpeedFromSpeedLimitByTag.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
import { COMPOSITION_CODES_MAX_SPEEDS } from '../consts'; | ||
|
||
/** | ||
* Get max speed in km/h from speedLimitByTag | ||
* @param speedLimitByTag - A string representing the speed limit tag | ||
* @returns The max speed in km/h, or undefined if not applicable | ||
*/ | ||
const maxSpeedFromSpeedLimitByTag = (speedLimitByTag?: string | null): number | undefined => { | ||
if (!speedLimitByTag) return undefined; | ||
|
||
const speedMap: Record<string, number | undefined> = { | ||
MA80: 80, | ||
MA90: 90, | ||
MA100: 100, | ||
ME100: 100, | ||
ME120: 120, | ||
ME140: 140, | ||
ME160: 160, | ||
HLP: undefined, | ||
MVGV: undefined, | ||
}; | ||
|
||
return speedMap[speedLimitByTag] ?? undefined; | ||
return COMPOSITION_CODES_MAX_SPEEDS[speedLimitByTag] ?? undefined; | ||
}; | ||
|
||
export default maxSpeedFromSpeedLimitByTag; |