forked from PolarisPyra/daphnis
cleaner variable name
This commit is contained in:
parent
43bbbdc61b
commit
6fcc30e4a4
@ -55,49 +55,51 @@ export async function getUserRatingBaseList() {
|
|||||||
(typeof staticMusicInfo)[0]
|
(typeof staticMusicInfo)[0]
|
||||||
>(staticMusicInfo.map((info) => [`${info.songId}-${info.chartId}`, info]));
|
>(staticMusicInfo.map((info) => [`${info.songId}-${info.chartId}`, info]));
|
||||||
|
|
||||||
const songsWithTitles = userRatingBaseList.map((ratingListSong) => {
|
const songsWithStaticMusicInfo = userRatingBaseList.map(
|
||||||
const MusicIdtoDiffId = `${ratingListSong.musicId}-${ratingListSong.difficultId}`;
|
(ratingListSong) => {
|
||||||
const songInfo = profileRatingToStaticMusic.get(MusicIdtoDiffId);
|
const MusicIdtoDiffId = `${ratingListSong.musicId}-${ratingListSong.difficultId}`;
|
||||||
|
const songInfo = profileRatingToStaticMusic.get(MusicIdtoDiffId);
|
||||||
|
|
||||||
const level = songInfo?.level ?? 0;
|
const level = songInfo?.level ?? 0;
|
||||||
const score = ratingListSong.score ?? 0;
|
const score = ratingListSong.score ?? 0;
|
||||||
|
|
||||||
// Rating Formula
|
// Rating Formula
|
||||||
let rating = 0;
|
let rating = 0;
|
||||||
|
|
||||||
if (score >= 1009000) {
|
if (score >= 1009000) {
|
||||||
rating = level * 100 + 215;
|
rating = level * 100 + 215;
|
||||||
} else if (score >= 1007500) {
|
} else if (score >= 1007500) {
|
||||||
rating = level * 100 + 200 + (score - 1007500) / 100;
|
rating = level * 100 + 200 + (score - 1007500) / 100;
|
||||||
} else if (score >= 1005000) {
|
} else if (score >= 1005000) {
|
||||||
rating = level * 100 + 150 + (score - 1005000) / 50;
|
rating = level * 100 + 150 + (score - 1005000) / 50;
|
||||||
} else if (score >= 1000000) {
|
} else if (score >= 1000000) {
|
||||||
rating = level * 100 + 100 + (score - 1000000) / 100;
|
rating = level * 100 + 100 + (score - 1000000) / 100;
|
||||||
} else if (score >= 975000) {
|
} else if (score >= 975000) {
|
||||||
rating = level * 100 + (score - 975000) / 250;
|
rating = level * 100 + (score - 975000) / 250;
|
||||||
} else if (score >= 925000) {
|
} else if (score >= 925000) {
|
||||||
rating = level * 100 - 300 + ((score - 925000) * 3) / 500;
|
rating = level * 100 - 300 + ((score - 925000) * 3) / 500;
|
||||||
} else if (score >= 900000) {
|
} else if (score >= 900000) {
|
||||||
rating = level * 100 - 500 + ((score - 900000) * 4) / 500;
|
rating = level * 100 - 500 + ((score - 900000) * 4) / 500;
|
||||||
} else if (score >= 800000) {
|
} else if (score >= 800000) {
|
||||||
rating =
|
rating =
|
||||||
(level * 100 - 500) / 2 +
|
(level * 100 - 500) / 2 +
|
||||||
((score - 800000) * ((level - 500) / 2)) / 100000;
|
((score - 800000) * ((level - 500) / 2)) / 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...ratingListSong,
|
...ratingListSong,
|
||||||
title: songInfo?.title || "Unknown Title",
|
title: songInfo?.title || "Unknown Title",
|
||||||
artist: songInfo?.artist || "Unknown Artist",
|
artist: songInfo?.artist || "Unknown Artist",
|
||||||
genre: songInfo?.genre || "Unknown Genre",
|
genre: songInfo?.genre || "Unknown Genre",
|
||||||
chartId: songInfo?.chartId || "Unknown chartId",
|
chartId: songInfo?.chartId || "Unknown chartId",
|
||||||
level: songInfo?.level || "Unknown Level",
|
level: songInfo?.level || "Unknown Level",
|
||||||
jacketPath: songInfo?.jacketPath || "",
|
jacketPath: songInfo?.jacketPath || "",
|
||||||
rating,
|
rating,
|
||||||
};
|
};
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return songsWithTitles;
|
return songsWithStaticMusicInfo;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching songs with titles:", error);
|
console.error("Error fetching songs with titles:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
Loading…
Reference in New Issue
Block a user