Skip to content

fix: correct needs_review flag lifecycle for hold and eligibility - #435

Merged
mdiapenabc merged 1 commit into
devfrom
fix/needs-review-flag-lifecycle
Aug 6, 2026
Merged

fix: correct needs_review flag lifecycle for hold and eligibility#435
mdiapenabc merged 1 commit into
devfrom
fix/needs-review-flag-lifecycle

Conversation

@mdiapenabc

@mdiapenabc mdiapenabc commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Description

needs_review is only set during eligibility upsert while a contact is On Hold. On dev, it was cleared on Resume only. Contacts that left hold via Set Not Eligible or forceUpdateCsaStatus kept a stale review flag, so many flagged records can show Needs Review even though they are no longer On Hold.

Possible cause: Review was only cleared on Resume, not Set Not Eligible or force update off hold.

Fix: Clear review when leaving On Hold (Resume, Set Not Eligible, force update). No change to eligibility upsert or when review is set.

What changed

  • Clear needsReview in updateCsaStatus when transitioning off on_hold (covers Resume and Set Not Eligible in one update)
  • Clear needsReview in forceUpdateCsaStatus when leaving on_hold (WKL/CRA bypass)
  • Remove the duplicate clear in resumeContacts (same behaviour, single DB write)
  • Add unit tests for Resume, Set Not Eligible, and force update exit paths

How to test

  • Put a contact On Hold, run eligibility so needs_review is set, then Resume, review flag cleared, status updated
  • Same setup, use Set Not Eligible from On Hold , review flag cleared, status is not_eligible_out_of_pay
  • Confirm eligibility upsert still sets review when On Hold + staging data changed (unchanged behaviour)
  • Run npm test -- --run src/api/contacts/contacts.service.spec.ts in backend/

@mdiapenabc
mdiapenabc marked this pull request as draft August 5, 2026 20:41
@mdiapenabc
mdiapenabc force-pushed the fix/needs-review-flag-lifecycle branch from 4c90598 to 75a369a Compare August 5, 2026 21:18
@mdiapenabc
mdiapenabc marked this pull request as ready for review August 5, 2026 21:19
@mdiapenabc
mdiapenabc marked this pull request as draft August 5, 2026 21:30
Centralize review flag clearing in updateCsaStatus for all transitions
off on_hold (resume, set not eligible) and in forceUpdateCsaStatus for
WKL/CRA bypass paths. Removes the duplicate clear on resumeContacts.
@mdiapenabc
mdiapenabc force-pushed the fix/needs-review-flag-lifecycle branch from 75a369a to 6875bef Compare August 5, 2026 21:38
@mdiapenabc
mdiapenabc marked this pull request as ready for review August 6, 2026 14:03
@mdiapenabc
mdiapenabc merged commit dede4b6 into dev Aug 6, 2026
24 checks passed
@mdiapenabc
mdiapenabc deleted the fix/needs-review-flag-lifecycle branch August 6, 2026 17:24
mdiapenabc added a commit that referenced this pull request Aug 7, 2026
Re-sync contacts.service with dev after merge regressions: clear
needsReview when leaving on_hold in updateCsaStatus and
forceUpdateCsaStatus, remove duplicate clear from resumeContacts,
and restore the corresponding unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants