Adjusted sensitivity, and a weird edgecase where signoffs hit random people

This commit is contained in:
Jacob Henry 2018-11-20 16:15:32 -05:00
parent f30bc04db7
commit 8e4b107bc1
2 changed files with 8 additions and 5 deletions

View File

@ -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.9
SHEET_LOOKUP_THRESHOLD = 0.8
JOB_VAL = 1
LATE_VAL = 0.5

View File

@ -13,7 +13,7 @@ import slack_util
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
MIN_RATIO = 0.9
MIN_RATIO = 0.8
def alert_user(slack: SlackClient, brother: scroll_util.Brother, saywhat: str) -> None:
@ -160,8 +160,9 @@ async def signoff_callback(slack: SlackClient, msg: dict, match: Match) -> None:
# Score by name similarity, only accepting non-assigned jobs
def scorer(assign: house_management.JobAssignment):
if assign.signer is None:
return fuzz.ratio(signee.name, assign.assignee.name)
r = fuzz.ratio(signee.name, assign.assignee.name)
if assign.signer is None and r > MIN_RATIO:
return r
# Set the assigner, and notify
def modifier(context: _ModJobContext):
@ -186,7 +187,9 @@ async def late_callback(slack: SlackClient, msg: dict, match: Match) -> None:
# Score by name similarity. Don't care if signed off or not
def scorer(assign: house_management.JobAssignment):
return fuzz.ratio(signee.name, assign.assignee.name)
r = fuzz.ratio(signee.name, assign.assignee.name)
if r > MIN_RATIO:
return r
# Just set the assigner
def modifier(context: _ModJobContext):