108 lines
4.1 KiB
Markdown
108 lines
4.1 KiB
Markdown
# Plan: Fix Appreciation System Disconnects
|
|
|
|
## Issues Found
|
|
|
|
### 1. Patient Experience Issues
|
|
|
|
**A. Success message is misleading**
|
|
- Current: "will be shared with the staff member you recognized"
|
|
- Reality: Saved as DRAFT, needs staff review before sharing
|
|
- Fix: Change wording to "will be reviewed and shared"
|
|
|
|
**B. Reference number hidden from patient**
|
|
- Backend generates `APR-{uuid[:8]}` but JS hides the reference block
|
|
- Patient has no way to reference their submission
|
|
- Fix: Show reference number (or remove it entirely if not needed)
|
|
|
|
**C. No tracking page**
|
|
- Complaints and observations have `/track/` pages
|
|
- Appreciations have no equivalent tracking URL
|
|
- Fix: Add `public_appreciation_track` view
|
|
|
|
**D. No notification back to patient**
|
|
- When reviewer activates appreciation, patient is never notified
|
|
- Fix: Send email/SMS to `submitted_by_email`/`submitted_by_phone` on activation
|
|
|
|
### 2. Review Page Issues
|
|
|
|
**E. Staff field marked required but not enforced**
|
|
- UI shows red asterisk, but backend allows activation without staff
|
|
- Fix: Make staff required in `review_activate`, or remove asterisk
|
|
|
|
**F. No reject/delete action**
|
|
- Reviewers can only "Activate" — no way to reject inappropriate submissions
|
|
- Fix: Add "Reject" button that changes status to a new "rejected" status or deletes
|
|
|
|
**G. px_staff sees all hospitals**
|
|
- `is_px_staff()` bypasses hospital filtering in `review_list`
|
|
- Fix: Filter px_staff to their hospital only
|
|
|
|
### 3. Template Errors
|
|
|
|
**H. `recipient_name` doesn't exist on model**
|
|
- Template uses `{{ appreciation.recipient_name }}` but model only has `get_recipient_name()`
|
|
- Fix: Change to `{{ appreciation.get_recipient_name }}` in all templates
|
|
|
|
**I. Null sender crashes templates**
|
|
- Public submissions have no sender, but templates call `appreciation.sender.get_full_name`
|
|
- Fix: Add null checks
|
|
|
|
### 4. Backend Logic Issues
|
|
|
|
**J. Re-activation not guarded**
|
|
- `review_activate` allows re-activating already-SENT appreciations
|
|
- Fix: Add status guard
|
|
|
|
**K. Category assignment is arbitrary**
|
|
- `AppreciationCategory.objects.filter(is_active=True).first()` grabs first category
|
|
- Fix: Leave category null, let reviewer choose
|
|
|
|
**L. `message_ar` never populated**
|
|
- Public form has no Arabic input field
|
|
- Fix: Either add Arabic field or auto-translate
|
|
|
|
### 5. Dead Code
|
|
|
|
**M. `public_appreciation_success` template/view unused**
|
|
- Public form uses inline modal instead
|
|
- Fix: Remove or integrate
|
|
|
|
## Questions
|
|
|
|
1. **Should the patient get a reference number and tracking?** Or is "thank you" enough with no tracking?
|
|
|
|
2. **Should the patient be notified** when their appreciation is activated (email/SMS)?
|
|
|
|
3. **Should reviewers be able to reject** inappropriate appreciations? If so, what status — "rejected" or delete?
|
|
|
|
4. **Should the public form have an Arabic message field** alongside English?
|
|
|
|
5. **Should appreciations have a tracking page** like complaints/observations, or is the review-to-send flow sufficient?
|
|
|
|
## Priority Order
|
|
|
|
| Priority | Issue | File |
|
|
|----------|-------|------|
|
|
| High | Fix success message wording | public_submit.html |
|
|
| High | Fix `recipient_name` in templates | appreciation_list.html, appreciation_detail.html |
|
|
| High | Add null sender guards | appreciation_detail.html |
|
|
| Medium | Enforce staff required in review | ui_views.py, review_detail.html |
|
|
| Medium | Add reject/delete action | ui_views.py, review_detail.html |
|
|
| Medium | Fix px_staff hospital scope | ui_views.py |
|
|
| Medium | Notify patient on activation | signals.py |
|
|
| Low | Guard re-activation | ui_views.py |
|
|
| Low | Fix category assignment | ui_views.py |
|
|
| Low | Handle message_ar | public_submit.html, ui_views.py |
|
|
|
|
## Expected Outcome
|
|
|
|
After fixes:
|
|
- Patient submits → sees accurate "thank you, will be reviewed" message
|
|
- Appreciation saved as DRAFT with no arbitrary category
|
|
- Reviewer sees all pending appreciations (scoped to their hospital)
|
|
- Reviewer must select staff before activation
|
|
- Reviewer can reject inappropriate submissions
|
|
- On activation: recipient + department heads + patient are notified
|
|
- Templates never crash on null sender/recipient
|
|
- No dead code
|