Skip to content

feat(queue): implement queue cancellation support and fix test env#16

Merged
6reenhorn merged 2 commits into
mainfrom
development
Apr 30, 2026
Merged

feat(queue): implement queue cancellation support and fix test env#16
6reenhorn merged 2 commits into
mainfrom
development

Conversation

@6reenhorn
Copy link
Copy Markdown
Owner

This PR introduces the ability for users to cancel their active queue tracking sessions. This addresses the scenario where a user might join a queue with the wrong ticket number or institution and needs to "exit" the session to join correctly.

Additionally, this PR includes critical fixes for the development environment and CI stability.

Key Changes

  • New Feature: Queue Cancellation

    • Added a POST endpoint: /api/queue/entries/{session_id}/cancel/.
    • Active sessions (waiting, notified, serving) can now be marked as cancelled.
    • Cancelling a session triggers a final notification and releases the ticket number, allowing it to be tracked again immediately.
  • Infrastructure & Config Fixes

    • CORS Robustness: Updated settings.py to strip trailing slashes from CORS_ALLOWED_ORIGINS, preventing common configuration errors.
    • Fast Testing: Updated IS_TEST_ENV to recognize manage.py test, ensuring local tests use a fast, clean in-memory SQLite database instead of trying to connect to a persistent Postgres instance.
  • Documentation

    • Updated API_ENDPOINTS.md with the new endpoint contract and updated the summary table.

Testing Done
Added 3 new automated test cases in queue_tracker/tests.py:

  1. test_cancel_success: Verifies state transition to cancelled and notification creation.
  2. test_cancel_already_cancelled: Ensures error handling for double cancellation.
  3. test_rejoin_after_cancel: Proves that a user can rejoin with the same number after cancelling their previous session.

Test Results:

Ran 3 tests in 0.554s
OK

@6reenhorn 6reenhorn merged commit 199f2ea into main Apr 30, 2026
2 checks passed
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