From 0d7409906a9c78016a0af678b463f131e0398cc1 Mon Sep 17 00:00:00 2001 From: Wanich Keatkajonjumroen Date: Wed, 30 Aug 2023 03:38:32 +0900 Subject: [PATCH] fixed backend ongeki rival functionality --- titles/ongeki/base.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/titles/ongeki/base.py b/titles/ongeki/base.py index ace1d12..9977157 100644 --- a/titles/ongeki/base.py +++ b/titles/ongeki/base.py @@ -978,35 +978,41 @@ class OngekiBase: """ Added in Bright """ - rival_list = self.data.profile.get_rivals(data["userId"]) - if rival_list is None or len(rival_list) < 1: + + rival_list = [] + user_rivals = self.data.profile.get_rivals(data["userId"]) + for rival in user_rivals: + tmp = {} + tmp["rivalUserId"] = rival[0] + rival_list.append(tmp) + + if user_rivals is None or len(rival_list) < 1: return { "userId": data["userId"], "length": 0, "userRivalList": [], } - return { "userId": data["userId"], "length": len(rival_list), - "userRivalList": rival_list._asdict(), + "userRivalList": rival_list, } - def handle_get_user_rival_data_api_reqiest(self, data: Dict) -> Dict: + def handle_get_user_rival_data_api_request(self, data: Dict) -> Dict: """ Added in Bright """ rivals = [] - + print(data) for rival in data["userRivalList"]: name = self.data.profile.get_profile_name( rival["rivalUserId"], self.version ) if name is None: continue - - rivals.append({"rivalUserId": rival["rival"], "rivalUserName": name}) - + print(name) + rivals.append({"rivalUserId": rival["rivalUserId"], "rivalUserName": name}) + print(rivals) return { "userId": data["userId"], "length": len(rivals), @@ -1027,7 +1033,7 @@ class OngekiBase: for song in music["userMusicList"]: song["userRivalMusicDetailList"] = song["userMusicDetailList"] song.pop("userMusicDetailList") - + print(music["userMusicList"]) return { "userId": data["userId"], "rivalUserId": rival_id,