1
0
forked from Hay1tsme/artemis

fixed backend ongeki rival functionality

This commit is contained in:
Wanich Keatkajonjumroen 2023-08-30 03:38:32 +09:00
parent 5cccc9224a
commit 0d7409906a

View File

@ -978,35 +978,41 @@ class OngekiBase:
""" """
Added in Bright 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 { return {
"userId": data["userId"], "userId": data["userId"],
"length": 0, "length": 0,
"userRivalList": [], "userRivalList": [],
} }
return { return {
"userId": data["userId"], "userId": data["userId"],
"length": len(rival_list), "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 Added in Bright
""" """
rivals = [] rivals = []
print(data)
for rival in data["userRivalList"]: for rival in data["userRivalList"]:
name = self.data.profile.get_profile_name( name = self.data.profile.get_profile_name(
rival["rivalUserId"], self.version rival["rivalUserId"], self.version
) )
if name is None: if name is None:
continue continue
print(name)
rivals.append({"rivalUserId": rival["rival"], "rivalUserName": name}) rivals.append({"rivalUserId": rival["rivalUserId"], "rivalUserName": name})
print(rivals)
return { return {
"userId": data["userId"], "userId": data["userId"],
"length": len(rivals), "length": len(rivals),
@ -1027,7 +1033,7 @@ class OngekiBase:
for song in music["userMusicList"]: for song in music["userMusicList"]:
song["userRivalMusicDetailList"] = song["userMusicDetailList"] song["userRivalMusicDetailList"] = song["userMusicDetailList"]
song.pop("userMusicDetailList") song.pop("userMusicDetailList")
print(music["userMusicList"])
return { return {
"userId": data["userId"], "userId": data["userId"],
"rivalUserId": rival_id, "rivalUserId": rival_id,