diff --git a/house_management.py b/house_management.py index a927d72..a352ec1 100644 --- a/house_management.py +++ b/house_management.py @@ -14,7 +14,7 @@ job_range = "AllJobs" # Note that the first row is headers point_range = "PointRange" # How tolerant of spelling errors in names to be -SHEET_LOOKUP_THRESHOLD = 0.8 +SHEET_LOOKUP_THRESHOLD = 80.0 JOB_VAL = 1 LATE_VAL = 0.5 diff --git a/job_commands.py b/job_commands.py index 52e28ea..9c3c12d 100644 --- a/job_commands.py +++ b/job_commands.py @@ -13,7 +13,7 @@ import slack_util SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM" -MIN_RATIO = 0.8 +MIN_RATIO = 80.0 def alert_user(slack: SlackClient, brother: scroll_util.Brother, saywhat: str) -> None: diff --git a/scroll_util.py b/scroll_util.py index 87d146e..0c23b05 100644 --- a/scroll_util.py +++ b/scroll_util.py @@ -51,10 +51,7 @@ async def scroll_callback(slack: SlackClient, msg: dict, match: Match) -> None: sn = int(query) result = find_by_scroll(sn) except ValueError: - try: - result = await find_by_name(query) - except BrotherNotFound: - pass + result = await find_by_name(query) if result: result = "Brother {} has scroll {}".format(result.name, result.scroll) else: @@ -96,9 +93,9 @@ async def find_by_name(name: str, threshold: Optional[float] = None) -> Brother: # Do fuzzy match found, score = process.extractOne(name, all_names) - score = score / 100.0 found_index = all_names.index(found) found_brother = brothers[found_index] + print(score) if (not threshold) or score > threshold: return found_brother else: