From ce42aadd444ed233e50fdf8da124f54a37766ae4 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Mon, 22 May 2023 10:27:30 +0100 Subject: [PATCH] Front: Fix Score computation --- front/views/PlayView.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 870c008..34d4231 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -119,9 +119,9 @@ const PlayView = ({ songId, type, route }: RouteProps) => { return; } const points = data.info.score; - const maxPoints = data.info.maxScore || 1; + const maxPoints = data.info.max_score || 1; - setScore(Math.floor(Math.max(points, 0) / maxPoints) * 100); + setScore(Math.floor(Math.max(points, 0) * 100 / maxPoints)); let formattedMessage = ''; let messageColor: ColorSchemeType | undefined; @@ -163,9 +163,7 @@ const PlayView = ({ songId, type, route }: RouteProps) => { } input.onmidimessage = (message) => { const { command, channel, note, velocity } = parseMidiMessage(message); - console.log(command, channel, note, velocity); - const keyIsPressed = command == 9; - console.log(keyIsPressed); + const keyIsPressed = command == 9;; const keyCode = message.data[1]; // console.log('Playing midi ' + keyCode + ' at time ' + getElapsedTime()); webSocket.current?.send(