From 80f8ebd4766fb5464a13ec7ce1eff1f1c8f0c0ea Mon Sep 17 00:00:00 2001 From: Thomas Couchoud Date: Wed, 3 Feb 2021 18:35:09 +0100 Subject: [PATCH] Attempt to fix PREDICTION showing with count -1 in final report --- TwitchChannelPointsMiner/classes/WebSocketsPool.py | 4 +--- TwitchChannelPointsMiner/classes/entities/Streamer.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/TwitchChannelPointsMiner/classes/WebSocketsPool.py b/TwitchChannelPointsMiner/classes/WebSocketsPool.py index 8c14077..d860865 100644 --- a/TwitchChannelPointsMiner/classes/WebSocketsPool.py +++ b/TwitchChannelPointsMiner/classes/WebSocketsPool.py @@ -293,9 +293,8 @@ class WebSocketsPool: "REFUND", -points_placed, counter=-1, - create_if_missing=False, ) - else: + elif result_type == "WIN": logger.info( "REMOVE PREDICTION FROM POINTS MSG" ) # TODO remove @@ -303,7 +302,6 @@ class WebSocketsPool: "PREDICTION", -points_won, counter=-1, - create_if_missing=False, ) elif message.type == "prediction-made": event_prediction.bet_confirmed = True diff --git a/TwitchChannelPointsMiner/classes/entities/Streamer.py b/TwitchChannelPointsMiner/classes/entities/Streamer.py index 301aa57..a97b774 100644 --- a/TwitchChannelPointsMiner/classes/entities/Streamer.py +++ b/TwitchChannelPointsMiner/classes/entities/Streamer.py @@ -91,10 +91,8 @@ class Streamer(object): ] ) - def update_history(self, reason_code, earned, counter=1, create_if_missing=True): + def update_history(self, reason_code, earned, counter=1): if reason_code not in self.history: - if not create_if_missing: - return self.history[reason_code] = {"counter": 0, "amount": 0} self.history[reason_code]["counter"] += counter self.history[reason_code]["amount"] += earned