From 5f33b2d3e48336c78f74d996e07cda15a6c2231b Mon Sep 17 00:00:00 2001 From: Kumubou Date: Wed, 3 Jan 2024 22:05:24 +0000 Subject: [PATCH] Fix issue in handle_get_user_music_api_request where songs would not always return all scores --- titles/chuni/base.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 674fb9c..8d22488 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -608,16 +608,14 @@ class ChuniBase: if len(song_list) >= max_ct: break - try: - while song_list[-1]["userMusicDetailList"][0]["musicId"] == music_detail[x + 1]["musicId"]: - music = music_detail[x + 1]._asdict() - music.pop("user") - music.pop("id") - song_list[-1]["userMusicDetailList"].append(music) - song_list[-1]["length"] += 1 - x += 1 - except IndexError: - pass + for songIdx in range(len(song_list)): + for recordIdx in range(x+1, len(music_detail)): + if song_list[songIdx]["userMusicDetailList"][0]["musicId"] == music_detail[recordIdx]["musicId"]: + music = music_detail[recordIdx]._asdict() + music.pop("user") + music.pop("id") + song_list[songIdx]["userMusicDetailList"].append(music) + song_list[songIdx]["length"] += 1 if len(song_list) >= max_ct: next_idx += len(song_list)