Add practical support workflow with status tracking#3552
Open
Rolling2405 wants to merge 6 commits into
Open
Conversation
Status workflow: - 5 statuses: Requested → In Progress → Confirmed → Completed + Cancelled - Default: Requested (integer enum, 0) - Any status can transition to Cancelled - status_updated_at tracks when status last changed - confirmed_at records when support was confirmed Color-coded badges: - Requested: gray (bg-secondary) - In Progress: cyan (bg-info) - Confirmed: blue (bg-primary) - Completed: green (bg-success) - Cancelled: red (bg-danger) Views: - Status badge column added to practical support entries table - Status dropdown added to practical support edit form - Status included in permitted params Overdue detection: - PracticalSupport.overdue scope: requested/in_progress for >7 days - PracticalSupport.active scope: excludes completed/cancelled - OverdueSupportAlertJob runs daily at 7am via Solid Queue - Notifies admins about overdue supports via notification center Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change 'type:' to 'notification_type:' and 'related:' to 'link:' in OverdueSupportAlertJob to match Notification.notify! API signature - Replace nonexistent 'related_type'/'related_id' column queries with 'link'-based duplicate check - Use BS4 'badge-*' classes instead of BS5 'bg-*' for proper text color Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ensive tests - Rename enum value 'confirmed' → 'approved' to avoid collision with boolean confirmed column (which is removed in the migration) - Expand→contract migration: add status column, backfill data from confirmed/fulfilled booleans, then drop both boolean columns - Fix overdue scope to use status_updated_at instead of created_at - Remove confirmed/fulfilled checkboxes from views (replaced by status dropdown) - Remove confirmed/fulfilled from strong params - Update Patient.unconfirmed_practical_support to use status enum - Update Exportable concern to use status instead of booleans - Update practical_support_display_text helper - Update factory, controller tests, model tests, helper tests, system tests, and exportable tests to use new status enum instead of booleans - Add comprehensive model tests: enum values, default status, transitions, overdue scope, badge_color, track_status_change callback, active scope - Fix migration version [8.0] → [8.1] - Fix overdue job to use status_updated_at with fallback to created_at Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 9, 2026
New records with default status='requested' may have NULL status_updated_at (from migration or edge cases). COALESCE falls back to created_at so they aren't silently excluded from overdue detection. Also initialize status_updated_at on new records via after_initialize callback for better data consistency going forward. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Two fixes: 1. OverdueSupportAlertJob references the Notification model from the unmerged feature/notification-center branch. Add a defined?(Notification) guard so the job gracefully skips when the model is unavailable. 2. The AddStatusToPracticalSupports migration violated expand-contract by adding new columns and removing old ones in a single migration. Split into two migrations: - 20250101000006: expand phase (add status enum, backfill data) - 20250101000007: contract phase (remove confirmed/fulfilled columns) Add self.ignored_columns to PracticalSupport model so ActiveRecord ignores the legacy columns between deploy phases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add OverdueSupportAlertJob tests (guard clause, notification creation, dedup, admin targeting) - Add cancelled-from-any-state and invalid status enum tests to model - Add overdue scope boundary tests (in_progress, 7-day boundary, cancelled exclusion) - Add controller test for status param update via PATCH Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I rule and have completed some work on Case Manager that's ready for review!
This replaces the simple confirmed/fulfilled checkboxes on practical supports with a full status workflow (requested → in progress → approved → completed → cancelled), plus automatic overdue alerts. Case managers can now track practical support requests through their full lifecycle.
This pull request makes the following changes:
status_updated_attimestampfulfilled: true→ completed,confirmed: true→ approved, neither → requestedOverdueSupportAlertJobrecurring job that creates notifications for overdue supportsNotes:
#3538→#3552.(If there are changes to the views, please include a screenshot so we know what to look for!)
For reviewer:
featureif it contains a feature, fix, or similar. This is anything that contains a user-facing fix in some way, such as frontend changes, alterations to backend behavior, or bug fixes.dependenciesif it contains library upgrades or similar. This is anything that upgrades any dependency, such as a Gemfile update or npm package upgrade.