aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar PythonTryHard <[email protected]>2021-09-24 20:40:45 +0700
committerGravatar PythonTryHard <[email protected]>2021-09-24 20:40:45 +0700
commitc893e86b61e5309d4bd6a03259f6e87fa76d4f39 (patch)
treec23539fa2fb8d4a649dc0b92188af8e72a7a210b /bot
parentMerge pull request #873 from python-discord/no-hangman-multiplayer (diff)
Bisect only on love percent thresholds
Diffstat (limited to 'bot')
-rw-r--r--bot/exts/holidays/valentines/lovecalculator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/exts/holidays/valentines/lovecalculator.py b/bot/exts/holidays/valentines/lovecalculator.py
index 3999db2b..3ef9c3e1 100644
--- a/bot/exts/holidays/valentines/lovecalculator.py
+++ b/bot/exts/holidays/valentines/lovecalculator.py
@@ -74,7 +74,8 @@ class LoveCalculator(Cog):
# We need the -1 due to how bisect returns the point
# see the documentation for further detail
# https://docs.python.org/3/library/bisect.html#bisect.bisect
- index = bisect.bisect(LOVE_DATA, (love_percent,)) - 1
+ love_threshold = [threshold for threshold, _ in LOVE_DATA]
+ index = bisect.bisect(love_threshold, love_percent) - 1
# We already have the nearest "fit" love level
# We only need the dict, so we can ditch the first element
_, data = LOVE_DATA[index]