diff --git a/flake.nix b/flake.nix index 6b6a0fd..9721b18 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,9 @@ nodePackages."@nestjs/cli" nodePackages.npm nodejs-slim + yarn + python3 + pkg-config ]; shellHook = with pkgs; '' export PRISMA_MIGRATION_ENGINE_BINARY="${prisma-engines}/bin/migration-engine" diff --git a/front/API.ts b/front/API.ts index 775887f..972baf9 100644 --- a/front/API.ts +++ b/front/API.ts @@ -331,10 +331,10 @@ export default class API { * Retrieve a song's play history * @param songId the id to find the song */ - public static async getSongHistory(songId: number): Promise { + public static async getSongHistory(songId: number): Promise<{best: number, history: SongHistory[]}> { return API.fetch({ - route: `/history`, - }).then((data: SongHistory[]) => data.filter((entry) => entry.songID == songId)) + route: `/song${songId}/history`, + }); } /** diff --git a/front/tsconfig.json b/front/tsconfig.json index db05a4e..e7f36ff 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -84,8 +84,8 @@ "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ - "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ + "noUnusedLocals": false, /* Enable error reporting when a local variables aren't read. */ + "noUnusedParameters": false, /* Raise an error when a function parameter isn't read */ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ diff --git a/front/views/ScoreView.tsx b/front/views/ScoreView.tsx index 686cfe5..3a309c5 100644 --- a/front/views/ScoreView.tsx +++ b/front/views/ScoreView.tsx @@ -14,13 +14,13 @@ const ScoreView = ({ songId, route }: RouteProps) => { const theme = useTheme(); const navigation = useNavigation(); const songQuery = useQuery(['song', songId], () => API.getSong(songId)); - const artistQuery = useQuery(['song', songId], + const artistQuery = useQuery(['song', songId, "artist"], () => API.getArtist(songQuery.data!.artistId!), { enabled: songQuery.data != undefined } ); const songHistoryQuery = useQuery(["song", "history"], () => API.getUserPlayHistory()); // const perfoamnceRecommandationsQuery = useQuery(['song', props.songId, 'score', 'latest', 'recommendations'], () => API.getLastSongPerformanceScore(props.songId)); - const recommendations = useQuery(['song', 'recommendations'], () => API.getUserRecommendations()); + const recommendations = useQuery(['song', songId, 'recommendations'], () => API.getUserRecommendations()); const artistRecommendations = useQueries(recommendations.data ?.filter(({ artistId }) => artistId !== null) .map((song) => ({ @@ -36,7 +36,7 @@ const ScoreView = ({ songId, route }: RouteProps) => { if (!songScore) { return
- navigation.navigate('Home')} /> @@ -57,7 +57,7 @@ const ScoreView = ({ songId, route }: RouteProps) => { {/* - + ' ' + t}/> diff --git a/front/views/SongLobbyView.tsx b/front/views/SongLobbyView.tsx index 019c034..0254eec 100644 --- a/front/views/SongLobbyView.tsx +++ b/front/views/SongLobbyView.tsx @@ -59,13 +59,13 @@ const SongLobbyView = (props: RouteProps) => { - {scoresQuery.data!.sort()[0]?.score ?? 0} + {scoresQuery.data!.best ?? 0} - {scoresQuery.data!.slice(-1)[0]?.score ?? 0} + {scoresQuery.data!.history[0]?.score ?? 0} {/* {songQuery.data!.description} */} @@ -79,7 +79,7 @@ const SongLobbyView = (props: RouteProps) => { { chaptersQuery.isLoading && } - { !chaptersQuery.isLoading && + { !chaptersQuery.isLoading && }> { chaptersQuery.data!.map((chapter) => @@ -96,4 +96,4 @@ const SongLobbyView = (props: RouteProps) => { ) } -export default SongLobbyView; \ No newline at end of file +export default SongLobbyView;