From 25ab37561db65172005e47d5268f7cd985bd5ecc Mon Sep 17 00:00:00 2001 From: UncleJim Date: Sun, 19 Nov 2023 11:54:04 +0000 Subject: [PATCH] fix the logic --- titles/idac/season2.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/titles/idac/season2.py b/titles/idac/season2.py index 39cf7d9..d1f6309 100644 --- a/titles/idac/season2.py +++ b/titles/idac/season2.py @@ -2388,16 +2388,18 @@ class IDACSeason2(IDACBase): vs_info["lose_now"] += 1 if data.get("win_flg") == 0 else 0 vs_info["break_count"] += data.get("break_count") vs_info["break_penalty_flag"] = data.get("break_penalty_flag") + course_exists = 0 for course in vs_info["vsinfo_course_data"]: if course["course_id"] == data.get("course_id"): course["vs_cnt"] += 1 course["vs_win"] += data.get("win_flg") - else: - course = {} - course["course_id"] = data.get("course_id") - course["vs_cnt"] = 1 - course["vs_win"] = data.get("win_flg") - vs_info["vsinfo_course_data"].append(course) + course_exists = 1 + if course_exists == 0: + course = {} + course["course_id"] = data.get("course_id") + course["vs_cnt"] = 1 + course["vs_win"] = data.get("win_flg") + vs_info["vsinfo_course_data"].append(course) self.data.item.put_vs_info(user_id, 0, vs_info) else: vs_info = { @@ -2509,16 +2511,18 @@ class IDACSeason2(IDACBase): vs_info["lose_now"] += 1 if data.get("win_flg") == 0 else 0 vs_info["break_count"] += data.get("break_count") vs_info["break_penalty_flag"] = data.get("break_penalty_flag") + course_exists = 0 for course in vs_info["vsinfo_course_data"]: if course["course_id"] == data.get("course_id"): course["vs_cnt"] += 1 course["vs_win"] += data.get("win_flg") - else: - course = {} - course["course_id"] = data.get("course_id") - course["vs_cnt"] = 1 - course["vs_win"] = data.get("win_flg") - vs_info["vsinfo_course_data"].append(course) + course_exists = 1 + if course_exists == 0: + course = {} + course["course_id"] = data.get("course_id") + course["vs_cnt"] = 1 + course["vs_win"] = data.get("win_flg") + vs_info["vsinfo_course_data"].append(course) self.data.item.put_vs_info(user_id, 1, vs_info) else: vs_info = {