Front: Play View: Get Score
This commit is contained in:
@@ -43,6 +43,9 @@ services:
|
||||
build:
|
||||
context: ./front
|
||||
dockerfile: Dockerfile.dev
|
||||
environment:
|
||||
- SCOROMETER_URL=http://scorometer:6543/
|
||||
- NGINX_PORT=80
|
||||
ports:
|
||||
- "19006:19006"
|
||||
volumes:
|
||||
|
||||
@@ -53,6 +53,7 @@ const PlayView = () => {
|
||||
const [midiPlayer, setMidiPlayer] = useState<MidiPlayer.Player>();
|
||||
const [isVirtualPianoVisible, setVirtualPianoVisible] = useState<boolean>(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 <Center style={{ flexGrow: 1 }}>
|
||||
|
||||
Reference in New Issue
Block a user