Link demo specialty desks after SSO remap and tighten keyword matching.
Deploy Ladill Care / deploy (push) Successful in 58s

Specialty seeder looked up members by email user_ref only, so remapped
demo logins never got practitioner.member_id and saw every module.
Also stop short keywords like "ent" matching "dentistry".

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 22:18:49 +00:00
co-authored by Cursor
parent d02760c527
commit c8a7115e49
4 changed files with 133 additions and 11 deletions
+31 -2
View File
@@ -421,8 +421,7 @@ class SpecialtyModuleService
continue;
}
foreach ($keywords as $keyword) {
$needle = strtolower((string) $keyword);
if ($needle !== '' && str_contains($hay, $needle)) {
if ($this->specialtyKeywordMatches($hay, strtolower((string) $keyword))) {
return true;
}
}
@@ -431,6 +430,36 @@ class SpecialtyModuleService
return false;
}
/**
* Match specialty text to a keyword without short-token false positives
* (e.g. "ent" must not match "dentistry"; "ear" must not match "year").
*/
protected function specialtyKeywordMatches(string $haystackLower, string $needleLower): bool
{
$needleLower = trim($needleLower);
if ($needleLower === '' || $haystackLower === '') {
return false;
}
if ($haystackLower === $needleLower) {
return true;
}
$quoted = preg_quote($needleLower, '/');
// Whole-word match covers short tokens (ent, ear, eye) and multi-word labels.
if (preg_match('/\b'.$quoted.'\b/u', $haystackLower) === 1) {
return true;
}
// Longer stems may prefix a token (dent→dentistry, cardio→cardiology).
if (strlen($needleLower) >= 4 && preg_match('/\b'.$quoted.'/u', $haystackLower) === 1) {
return true;
}
return false;
}
protected function isGeneralPracticeSpecialty(string $specialtyLower): bool
{
if (in_array($specialtyLower, [