UC006: Sort Tasks¶
Overview¶
| Property | Value |
|---|---|
| ID | UC006 |
| Level | User Goal |
| Primary Actor | User |
| Trigger | User selects a sort order from the sort dropdown. |
| Precondition | None. The task list may be empty. |
| Success Guarantee | User sees all tasks ordered by the chosen sort order. |
| Related Rules | — |
| Related Feature | UC006-sort-tasks.feature |
Goal¶
The User wants to view tasks in a meaningful order — by workflow Status (TODO → IN_PROGRESS → DONE), by soonest due date, or by latest due date. Sorting is performed server-side so that the order is consistent and the feature remains compatible with future pagination.
This use case does not modify any data.
Main Success Scenario¶
- User selects a sort order (Status, Ending Soonest, or Ending Latest) from the dropdown at the top of the task list.
- System sends
GET /api/tasks?sortBy=<order>to the backend. - System retrieves all
Taskrecords from the database and sorts them according to the chosen order. - System responds with HTTP 200 and the ordered list of tasks.
- System renders the sorted task list in the UI.
Extensions (Alternate Flows)¶
1a. No sort order selected (default view — Ending Soonest):
- System calls
GET /api/tasks?sortBy=ENDING_SOONEST. - System returns HTTP 200 with tasks ordered by earliest due date, nulls last.
- Use case ends successfully.
1b. No sort parameter supplied:
- System calls
GET /api/taskswithout asortByparameter. - System returns HTTP 200 with tasks in insertion order.
- Use case ends successfully.
3a. No tasks exist:
- System returns HTTP 200 with an empty array
[]. - UI displays an empty-state message.
- Use case ends successfully.
Sort Orders¶
sortBy value |
UI label | Order |
|---|---|---|
STATUS |
Status | TODO → IN_PROGRESS → DONE (workflow order) |
ENDING_SOONEST |
Ending Soonest | Earliest due date first; tasks without a due date appear last |
ENDING_LATEST |
Ending Latest | Latest due date first; tasks without a due date appear last |
Transaction Boundary¶
Read-only. No transaction required; a single database read query suffices.
Sequence Diagram¶
BDD Scenarios¶
The feature file is the single source of truth for behaviour — it is also executed as an acceptance test. See features/UC006-sort-tasks.feature.