forked from Dniel97/artemis
refactored vs_info
This commit is contained in:
parent
7b58cae214
commit
913987da1d
@ -2378,26 +2378,49 @@ class IDACSeason2(IDACBase):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.data.item.put_vs_info(user_id, data)
|
vs_info = self.data.item.get_vs_infos_by_mode(user_id, 0)
|
||||||
|
if vs_info is not None:
|
||||||
vs_info = {
|
vs_info["vs_cnt"] = vs_info["vs_cnt"] + 1
|
||||||
"battle_mode": 0,
|
vs_info["vs_win"] = vs_info["vs_win"] + data.get("win_flg")
|
||||||
"vs_cnt": 1,
|
vs_info["invalid"] = vs_info["invalid"] + data.get("result")
|
||||||
"vs_win": data.get("win_flg"),
|
vs_info["str"] = vs_info["str"] if vs_info["str"] > vs_info["str_now"] else vs_info["str_now"]
|
||||||
"invalid": 0,
|
vs_info["str_now"] = vs_info["str_now"] + data.get("win_flg") if data.get("win_flg") == 1 else 0
|
||||||
"str": 0,
|
vs_info["lose_now"] += 1 if data.get("win_flg") == 0 else 0
|
||||||
"str_now": 0,
|
vs_info["break_count"] += data.get("break_count")
|
||||||
"lose_now": 0,
|
vs_info["break_penalty_flag"] = data.get("break_penalty_flag")
|
||||||
"vs_history": data.get("vs_history"),
|
for course in vs_info["vsinfo_course_data"]:
|
||||||
"course_select_priority": data.get("course_select_priority"),
|
if course["course_id"] == data.get("course_id"):
|
||||||
"vsinfo_course_data": [
|
course["vs_cnt"] += 1
|
||||||
{
|
course["vs_win"] += data.get("win_flg")
|
||||||
"course_id": data.get("course_id"),
|
else:
|
||||||
"vs_cnt": 1,
|
course = {}
|
||||||
"vs_win": data.get("win_flg"),
|
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 = {
|
||||||
|
"battle_mode": 0,
|
||||||
|
"vs_cnt": 1,
|
||||||
|
"vs_win": data.get("win_flg"),
|
||||||
|
"invalid": data.get("result"),
|
||||||
|
"str": data.get("win_flg"),
|
||||||
|
"str_now": data.get("win_flg"),
|
||||||
|
"lose_now": 1 if data.get("win_flg") == 0 else 0,
|
||||||
|
"break_count": data.get("break_count"),
|
||||||
|
"break_penalty_flag": data.get("break_penalty_flag")
|
||||||
|
#"vs_history": data.get("vs_history"),
|
||||||
|
#"course_select_priority": data.get("course_select_priority"),
|
||||||
|
"vsinfo_course_data": [
|
||||||
|
{
|
||||||
|
"course_id": data.get("course_id"),
|
||||||
|
"vs_cnt": 1,
|
||||||
|
"vs_win": data.get("win_flg"),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
self.data.item.put_vs_info(user_id, 0, vs_info)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"status_code": "0",
|
"status_code": "0",
|
||||||
@ -2476,7 +2499,49 @@ class IDACSeason2(IDACBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# save vs_info in database
|
# save vs_info in database
|
||||||
self.data.item.put_vs_info(user_id, data)
|
vs_info = self.data.item.get_vs_infos_by_mode(user_id, 1)
|
||||||
|
if vs_info is not None:
|
||||||
|
vs_info["vs_cnt"] = vs_info["vs_cnt"] + 1
|
||||||
|
vs_info["vs_win"] = vs_info["vs_win"] + data.get("win_flg")
|
||||||
|
vs_info["invalid"] = vs_info["invalid"] + data.get("result")
|
||||||
|
vs_info["str"] = vs_info["str"] if vs_info["str"] > vs_info["str_now"] else vs_info["str_now"]
|
||||||
|
vs_info["str_now"] = vs_info["str_now"] + data.get("win_flg") if data.get("win_flg") == 1 else 0
|
||||||
|
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")
|
||||||
|
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)
|
||||||
|
self.data.item.put_vs_info(user_id, 1, vs_info)
|
||||||
|
else:
|
||||||
|
vs_info = {
|
||||||
|
"battle_mode": 0,
|
||||||
|
"vs_cnt": 1,
|
||||||
|
"vs_win": data.get("win_flg"),
|
||||||
|
"invalid": data.get("result"),
|
||||||
|
"str": data.get("win_flg"),
|
||||||
|
"str_now": data.get("win_flg"),
|
||||||
|
"lose_now": 1 if data.get("win_flg") == 0 else 0,
|
||||||
|
"break_count": data.get("break_count"),
|
||||||
|
"break_penalty_flag": data.get("break_penalty_flag")
|
||||||
|
#"vs_history": data.get("vs_history"),
|
||||||
|
#"course_select_priority": data.get("course_select_priority"),
|
||||||
|
"vsinfo_course_data": [
|
||||||
|
{
|
||||||
|
"course_id": data.get("course_id"),
|
||||||
|
"vs_cnt": 1,
|
||||||
|
"vs_win": data.get("win_flg"),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
self.data.item.put_vs_info(user_id, 1, vs_info)
|
||||||
|
|
||||||
vs_info = {
|
vs_info = {
|
||||||
"battle_mode": 0,
|
"battle_mode": 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user