Skip to content

fix(assign-doctor): show live pending queue counts per doctor

Swarna rathna madhuri Kanda requested to merge active-consultation-count into develop

This MR fixes an issue where the number of patients assigned to each doctor was not visible in the UI after assignment, even though the backend was returning the correct data.

It also includes test cases to validate that the pending queue count is correctly displayed and updated.


What does this MR do and why?

Previously, after assigning patients to doctors, the UI did not reflect the updated count of assigned patients. Although the backend response included the correct pending queue count, it was not being rendered in the doctor component.

The motivation behind this change is to ensure accurate, real-time visibility of doctor workloads and improve reliability through test coverage.

This MR updates the frontend logic and adds test cases to ensure the issue does not reoccur.


Changes Made

  • Fixed doctor card/component to display pending queue count
  • Updated API response mapping to UI state
  • Ensured proper re-render after assignment
  • Added test cases for pending queue count functionality
  • Updated CHANGELOG.md with this fix

Technical Details

Root Cause: The frontend was not correctly mapping or rendering the pending queue count from the backend response.

Fix:

  • Extracted and passed the correct field from API response
  • Updated component state handling
  • Triggered re-render after assignment

Testing Approach:

  • Added test cases to validate:

    • Correct rendering of pending count
    • UI updates after assignment
    • Consistency with backend response

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ️ Refactor (no functional changes)
  • Performance improvement
  • 🧪 Test update
  • 🔧 Configuration change
  • 🚨 Security fix

Related Issues / References

  • Fixes issue: pending queue count not visible after doctor assignment

related t0 #295 (closed)


Screenshots or Screen Recordings

before

Screenshot_from_2026-04-04_10-25-51

after

Screenshot_from_2026-04-04_12-04-53


How to Set Up and Validate Locally

  1. Checkout this branch:

    git checkout fix(assign-doctor-show-live-pending-counts)
  2. Install dependencies:

    bun install
  3. Run the development server:

    bun dev
  4. Steps to test:

    • Navigate to doctor assignment page
    • Assign patients to any doctor
    • Observe the doctor card
  5. Expected behavior:

    • Pending queue count updates and displays correctly for the assigned doctor

Testing Done

  • Manual testing completed
  • Unit tests added/updated

Test Cases Covered:

Scenario Expected Result Status
Assign patient to doctor Pending count increases and is displayed
Multiple assignments Count updates correctly for each doctor
API response mapping UI reflects backend data accurately
Component render test Doctor card shows correct pending count

Code Quality Checklist

Code Standards

  • Code follows project conventions
  • No console.log() or debugger statements left
  • No unused imports or variables
  • No duplicate code
  • i18n check passed
  • Proper TypeScript types used
  • ESLint and Prettier checks pass

React Best Practices

  • Components follow single responsibility
  • Hooks used correctly
  • Proper state management
  • No unnecessary re-renders
  • Event handlers handled properly

API & Data Fetching

  • API response handled correctly
  • Loading and error states considered
  • Types aligned with API structure

Error Handling

  • Errors handled gracefully
  • User-friendly feedback ensured

Documentation

  • README.md updated
  • .env.example updated
  • CHANGELOG.md updated

Known Limitations / Technical Debt

  • Depends on backend response structure consistency
  • Test coverage can be expanded further for edge cases

Additional Notes

This MR improves both functionality and reliability by fixing the UI issue and adding test coverage for future stability.


MR Acceptance Checklist

Evaluate this MR against the standard checklist to ensure quality, performance, and maintainability.

Edited by Swarna rathna madhuri Kanda

Merge request reports

Loading