diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 288cb90..4a02a12 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -43,6 +43,9 @@ services: build: context: ./front dockerfile: Dockerfile.dev + environment: + - SCOROMETER_URL=http://scorometer:6543/ + - NGINX_PORT=80 ports: - "19006:19006" volumes: diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 64a5fa9..50f4834 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -53,6 +53,7 @@ const PlayView = () => { const [midiPlayer, setMidiPlayer] = useState(); const [isVirtualPianoVisible, setVirtualPianoVisible] = useState(false); const [time, setTime] = useState(0); + const [score, setScore] = useState(0); // Between 0 and 100 const partitionRessources = useQuery(["partition", songId], () => API.getPartitionRessources(songId) ); @@ -115,6 +116,13 @@ const PlayView = () => { navigation.navigate('Score', { songId: song.data.id }); return; } + const points = data.info.score; + const maxPoints = data.info.maxScore; + if (points < 0) { + setScore(0); + } else { + setScore(Math.floor(point / maxPoints) * 100); + } let formattedMessage = ''; let messageColor: ColorSchemeType | undefined; @@ -199,7 +207,6 @@ const PlayView = () => { } }, [song.data]); - const score = 20; if (!song.data || !partitionRessources.data) { return