Front: Play View State: Reduce conditional complexity

This commit is contained in:
Arthur Jamet
2023-04-20 12:37:38 +01:00
parent 88cfd1ecde
commit 467f440c54

View File

@@ -114,11 +114,8 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
}
const points = data.info.score;
const maxPoints = data.info.maxScore;
if (points < 0) {
setScore(0);
} else {
setScore(Math.floor(points / maxPoints) * 100);
}
setScore(Math.floor(Math.max(points, 0) / maxPoints) * 100);
let formattedMessage = '';
let messageColor: ColorSchemeType | undefined;