Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1v committed Dec 20, 2022
1 parent 28ab872 commit 84b3dbe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
25 changes: 0 additions & 25 deletions TwitchChannelPointsMiner/classes/entities/Bet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
from TwitchChannelPointsMiner.utils import float_round


class Strategy(Enum):
MOST_VOTED = auto()
HIGH_ODDS = auto()
PERCENTAGE = auto()
SMART_MONEY = auto()
SMART = auto()

def __str__(self):
return self.name


class Condition(Enum):
GT = auto()
LT = auto()
Expand All @@ -33,20 +22,6 @@ def __str__(self):
return self.name


class OutcomeKeys(object):
# Real key on Bet dict ['']
PERCENTAGE_USERS = "percentage_users"
ODDS_PERCENTAGE = "odds_percentage"
ODDS = "odds"
TOP_POINTS = "top_points"
# Real key on Bet dict [''] - Sum()
TOTAL_USERS = "total_users"
TOTAL_POINTS = "total_points"
# This key does not exist
DECISION_USERS = "decision_users"
DECISION_POINTS = "decision_points"


class DelayMode(Enum):
FROM_START = auto()
FROM_END = auto()
Expand Down
6 changes: 5 additions & 1 deletion TwitchChannelPointsMiner/classes/entities/Strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from importlib import import_module
from random import uniform

from TwitchChannelPointsMiner.utils import char_decision_as_index
def char_decision_as_index(char):
return 0 if char == "A" else 1


class Condition(Enum):
Expand Down Expand Up @@ -75,9 +76,12 @@ def calculate_after(self, balance: int):
>= self.outcomes[index][OutcomeKeys.TOP_POINTS]
):
reduce_amount = uniform(1, 5)
# check by
# grep -r --include=*.log "Bet won't be placed as the amount -[0-9] is less than the minimum required 10" .
self.decision["amount"] = (
self.outcomes[index][OutcomeKeys.TOP_POINTS] - reduce_amount
)
if self.decision["amount"] < 10: self.decision["amount"] = 10
self.decision["amount"] = int(self.decision["amount"])

def calculate(self, balance: int) -> dict:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

from TwitchChannelPointsMiner.classes.entities.Strategy import OutcomeKeys, Strategy
from TwitchChannelPointsMiner.classes.entities.Strategy import OutcomeKeys, Strategy, char_decision_as_index
from TwitchChannelPointsMiner.classes.Settings import Settings
from TwitchChannelPointsMiner.utils import char_decision_as_index


logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion TwitchChannelPointsMiner/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def format(self, record):
and record.emoji_is_present is False
):
record.msg = emoji.emojize(
f"{record.emoji} {record.msg.strip()}", language="alias"
f"{record.emoji} {record.msg.strip()}", use_aliases=True
)
record.emoji_is_present = True

Expand Down

0 comments on commit 84b3dbe

Please sign in to comment.