diff options
author | mat <github@matdoes.dev> | 2022-03-27 18:16:02 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-03-27 18:16:02 -0500 |
commit | 3c2ff3de1dc67dee2824d37a71cefaae32da6b23 (patch) | |
tree | 54bd3ca1c3ddcc26b37563e8bf74e83a232bb32b /src/cleaners/skyblock/harp.ts | |
parent | cda39ef5dbb4d53929fba14d0086bf3ddf4d030b (diff) | |
download | skyblock-api-3c2ff3de1dc67dee2824d37a71cefaae32da6b23.tar.gz skyblock-api-3c2ff3de1dc67dee2824d37a71cefaae32da6b23.tar.bz2 skyblock-api-3c2ff3de1dc67dee2824d37a71cefaae32da6b23.zip |
Fix some harp songs showing twice
Diffstat (limited to 'src/cleaners/skyblock/harp.ts')
-rw-r--r-- | src/cleaners/skyblock/harp.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cleaners/skyblock/harp.ts b/src/cleaners/skyblock/harp.ts index 630f734..b1ec905 100644 --- a/src/cleaners/skyblock/harp.ts +++ b/src/cleaners/skyblock/harp.ts @@ -30,17 +30,18 @@ export async function cleanHarp(data: typedHypixelApi.SkyBlockProfileMember): Pr for (const item in data.harp_quest) { if (item.startsWith('song_') && item.endsWith('_best_completion')) { - const songName = item.slice('song_'.length, -'_best_completion'.length) + const apiSongName = item.slice('song_'.length, -'_best_completion'.length) + const songName = renamedSongs[apiSongName] ?? apiSongName songs.push({ - id: renamedSongs[songName] ?? songName, - completions: data.harp_quest[`song_${songName}_completions`] ?? 0, - perfectCompletions: data.harp_quest[`song_${songName}_perfect_completions`] ?? 0, - progress: data.harp_quest[`song_${songName}_best_completion`] ?? 0 + id: songName, + completions: data.harp_quest[`song_${apiSongName}_completions`] ?? 0, + perfectCompletions: data.harp_quest[`song_${apiSongName}_perfect_completions`] ?? 0, + progress: data.harp_quest[`song_${apiSongName}_best_completion`] ?? 0 }) } } - const missingHarpSongNames = allHarpSongNames.filter(songName => !songs.find(song => song.id === songName)) + const missingHarpSongNames = allHarpSongNames.filter(songName => !songs.find(song => (renamedSongs[song.id] ?? song.id) === songName)) for (const songName of missingHarpSongNames) { songs.push({ id: renamedSongs[songName] ?? songName, |