From 611b54ff92a2770115972d41d3e9bddcdc669a94 Mon Sep 17 00:00:00 2001 From: Nooqwaffle Date: Thu, 9 Nov 2023 10:44:01 -0500 Subject: [PATCH 1/2] #150 - handle test mode stat.ink results --- s3s.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/s3s.py b/s3s.py index 18b527b..92d4974 100755 --- a/s3s.py +++ b/s3s.py @@ -1277,20 +1277,26 @@ def post_result(data, ismonitoring, isblackout, istestrun, overview_data=None): except: print("Error with stat.ink. Please try again.") + detail_type = "vsHistoryDetail" if which == "ink" else "coopHistoryDetail" + result_id = results[i]["data"][detail_type]["id"] + noun = utils.set_noun(which)[:-1] + if istestrun and postbattle.status_code == 200: + print(f"Successfully validated {noun} ID {result_id} with stat.ink.") + return + if DEBUG: print(f"* time uploaded: {time_uploaded}; time now: {time_now}") if postbattle.status_code != 201: # Created (or already exists) - print(f"Error uploading {utils.set_noun(which)[:-1]}.") - detail_type = "vsHistoryDetail" if which == "ink" else "coopHistoryDetail" - result_id = results[i]["data"][detail_type]["id"] - print(f"{utils.set_noun(which)[:-1].capitalize()} ID: {result_id}") + print(f"Error uploading {noun}.") + + print(f"{noun.capitalize()} ID: {result_id}") print("Message from server:") print(postbattle.content.decode('utf-8')) elif time_uploaded <= time_now - 7: # give some leeway - print(f"{utils.set_noun(which)[:-1].capitalize()} already uploaded - {headerloc}") + print(f"{noun.capitalize()} already uploaded - {headerloc}") else: # 200 OK - print(f"{utils.set_noun(which)[:-1].capitalize()} uploaded to {headerloc}") + print(f"{noun.capitalize()} uploaded to {headerloc}") def check_for_updates(): From e7e4366ed5e64a8b74cb31f574829dd9a6055adb Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 17 Nov 2023 15:35:26 +0900 Subject: [PATCH 2/2] refactoring & version bump to v0.5.7 --- s3s.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/s3s.py b/s3s.py index 92d4974..e1fa9f5 100755 --- a/s3s.py +++ b/s3s.py @@ -11,7 +11,7 @@ import msgpack from packaging import version import iksm, utils -A_VERSION = "0.5.6" +A_VERSION = "0.5.7" DEBUG = False @@ -1280,21 +1280,21 @@ def post_result(data, ismonitoring, isblackout, istestrun, overview_data=None): detail_type = "vsHistoryDetail" if which == "ink" else "coopHistoryDetail" result_id = results[i]["data"][detail_type]["id"] noun = utils.set_noun(which)[:-1] - if istestrun and postbattle.status_code == 200: - print(f"Successfully validated {noun} ID {result_id} with stat.ink.") - return if DEBUG: print(f"* time uploaded: {time_uploaded}; time now: {time_now}") - if postbattle.status_code != 201: # Created (or already exists) - print(f"Error uploading {noun}.") + if istestrun and postbattle.status_code == 200: + print(f"Successfully validated {noun} ID {result_id} with stat.ink.") - print(f"{noun.capitalize()} ID: {result_id}") + elif postbattle.status_code != 201: # Created (or already exists) + print(f"Error uploading {noun}. (ID: {result_id})") print("Message from server:") print(postbattle.content.decode('utf-8')) + elif time_uploaded <= time_now - 7: # give some leeway print(f"{noun.capitalize()} already uploaded - {headerloc}") + else: # 200 OK print(f"{noun.capitalize()} uploaded to {headerloc}")