aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/harp.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-27 18:16:02 -0500
committermat <github@matdoes.dev>2022-03-27 18:16:02 -0500
commit3c2ff3de1dc67dee2824d37a71cefaae32da6b23 (patch)
tree54bd3ca1c3ddcc26b37563e8bf74e83a232bb32b /src/cleaners/skyblock/harp.ts
parentcda39ef5dbb4d53929fba14d0086bf3ddf4d030b (diff)
downloadskyblock-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.ts13
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,