diff --git a/apps/SeleniumService/selenium_DentaQuest_eligibilityCheckWorker.py b/apps/SeleniumService/selenium_DentaQuest_eligibilityCheckWorker.py index 8757f636..32d42dc2 100644 --- a/apps/SeleniumService/selenium_DentaQuest_eligibilityCheckWorker.py +++ b/apps/SeleniumService/selenium_DentaQuest_eligibilityCheckWorker.py @@ -502,10 +502,15 @@ class AutomationDentaQuestEligibilityCheck: ) status_text = status_elem.text.strip().lower() print(f"[DentaQuest step2] Found eligibility status: '{status_text}'") - if "active" in status_text or ("eligible" in status_text and "ineligible" not in status_text): - eligibilityText = "active" - elif "plan not accepted" in status_text: + # Check negatives first: "inactive" contains "active" and + # "not eligible"/"ineligible" contain "eligible". + if "plan not accepted" in status_text: eligibilityText = "plan not accepted" + elif ("inactive" in status_text or "ineligible" in status_text + or "not eligible" in status_text or "not active" in status_text): + eligibilityText = "inactive" + elif "active" in status_text or "eligible" in status_text: + eligibilityText = "active" else: eligibilityText = "inactive" except Exception as e: