improve code style

This commit is contained in:
eli fessler 2022-12-07 21:16:56 -10:00
parent 69a39c35ff
commit 22b22d7288

29
s3s.py
View File

@ -344,8 +344,7 @@ def fetch_detailed_result(is_vs_history, history_id, swim):
def update_salmon_profile():
''' Updates stat.ink Salmon Run stats/profile.'''
pass # SR TODO
pass
# prefetch_checks()
# results_list = requests.post(utils.GRAPHQL_URL,
@ -353,16 +352,17 @@ def update_salmon_profile():
# headers=headbutt(forcelang='en-US'),
# cookies=dict(_gtoken=GTOKEN))
# data = json.loads(results_list.text)
# profile = data["summary"]
# profile = data["..."]
# payload = {
# "work_count": profile["card"]["job_num"],
# "total_golden_eggs": profile["card"]["golden_ikura_total"],
# "total_eggs": profile["card"]["ikura_total"],
# "total_rescued": profile["card"]["help_total"],
# "total_point": profile["card"]["kuma_point_total"]
# # other new things - total fish scales, kings defeated, current & total points?
# }
# payload:
# current points
# jobs (shifts) worked
# golden eggs collected
# power eggs colleted
# king salmonids defeated
# crew members rescued
# total points
# current number of scales
# url = "https://stat.ink/api/v2/salmon-stats"
# auth = {'Authorization': f'Bearer {API_KEY}'}
@ -863,7 +863,7 @@ def prepare_job_result(job, ismonitoring, isblackout, overview_data=None, prevre
# compare stage - if different, this is the first job of a rotation, where you start at 40
if job["coopStage"]["id"] != prevresult["coopHistoryDetail"]["coopStage"]["id"]:
payload["title_before"] = payload["title_after"] # can't go up or down from just one job
payload["title_exp_before"] = "40"
payload["title_exp_before"] = 40
else:
try:
payload["title_before"] = utils.b64d(prevresult["coopHistoryDetail"]["afterGrade"]["id"])
@ -880,12 +880,12 @@ def prepare_job_result(job, ismonitoring, isblackout, overview_data=None, prevre
# do stage comparison again
if job["coopStage"]["id"] != prev_job["data"]["coopHistoryDetail"]["coopStage"]["id"]:
payload["title_before"] = payload["title_after"]
payload["title_exp_before"] = "40"
payload["title_exp_before"] = 40
else:
try:
payload["title_before"] = utils.b64d(prev_job["data"]["coopHistoryDetail"]["afterGrade"]["id"])
payload["title_exp_before"] = prev_job["data"]["coopHistoryDetail"]["afterGradePoint"]
except: # private or disconnect, or the json was invalid (expired job >50 ago) or something
except KeyError: # private or disconnect, or the json was invalid (expired job >50 ago) or something
pass
geggs = job["myResult"]["goldenDeliverCount"]
@ -1371,6 +1371,7 @@ def check_if_missing(which, isblackout, istestrun, skipprefetch):
noun = "jobs" # for second run through the loop
which = "salmon"
def check_for_new_results(which, cached_battles, cached_jobs, battle_wins, battle_losses, battle_draws, splatfest_wins, splatfest_losses, splatfest_draws, mirror_matches, job_successes, job_failures, isblackout, istestrun):
'''Helper function for monitor_battles(), called every N seconds or when exiting.'''