code touchups & fix #53

This commit is contained in:
eli fessler
2022-10-20 18:16:52 -10:00
parent 2aa215d90a
commit 85cf3f79c2

23
s3s.py
View File

@@ -8,7 +8,7 @@ import argparse, datetime, json, os, shutil, re, requests, sys, time, uuid
import msgpack
import iksm, utils
A_VERSION = "0.1.6"
A_VERSION = "0.1.7"
DEBUG = False
@@ -534,13 +534,28 @@ def prepare_battle_result(battle, ismonitoring, overview_data=None):
payload["our_team_inked"] = our_team_inked
payload["their_team_inked"] = their_team_inked
# Anarchy Battles only
if mode == "PRIVATE": # these don't get sent otherwise
try: # could be anarchy, maybe not
payload["knockout"] = "no" if battle["knockout"] is None or battle["knockout"] == "NEITHER" else "yes"
except:
pass
try:
payload["our_team_count"] = battle["myTeam"]["result"]["score"]
payload["their_team_count"] = battle["otherTeams"][0]["result"]["score"]
except:
pass
try:
payload["our_team_percent"] = float(battle["myTeam"]["result"]["paintRatio"]) * 100
payload["their_team_percent"] = float(battle["otherTeams"][0]["result"]["paintRatio"]) * 100
except:
pass
if mode == "BANKARA":
try:
payload["our_team_count"] = battle["myTeam"]["result"]["score"]
payload["their_team_count"] = battle["otherTeams"][0]["result"]["score"]
except TypeError: # draw - 'result' is null
except: # draw - 'result' is null
pass
payload["knockout"] = "no" if battle["knockout"] is None or battle["knockout"] == "NEITHER" else "yes"
@@ -1006,6 +1021,8 @@ def monitor_battles(which, secs, isblackout, istestrun):
except KeyboardInterrupt:
# print(f"\nChecking to see if there are unuploaded {utils.set_noun(which)} before exiting...") # TODO
# check LatestBattleHistoriesQuery against https://stat.ink/api/v3/s3s/uuid-list
# TODO - do update_salmon_profile() at end if salmon run
print("\n\nChecking for unuploaded results before exiting is not yet implemented.")
print("Please run s3s again with " + '\033[91m' + "-r" + '\033[0m' + " to get these battles.")