Skip to content

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

  1. User selects a sort order (Status, Ending Soonest, or Ending Latest) from the dropdown at the top of the task list.
  2. System sends GET /api/tasks?sortBy=<order> to the backend.
  3. System retrieves all Task records from the database and sorts them according to the chosen order.
  4. System responds with HTTP 200 and the ordered list of tasks.
  5. System renders the sorted task list in the UI.

Extensions (Alternate Flows)

1a. No sort order selected (default view — Ending Soonest):

  1. System calls GET /api/tasks?sortBy=ENDING_SOONEST.
  2. System returns HTTP 200 with tasks ordered by earliest due date, nulls last.
  3. Use case ends successfully.

1b. No sort parameter supplied:

  1. System calls GET /api/tasks without a sortBy parameter.
  2. System returns HTTP 200 with tasks in insertion order.
  3. Use case ends successfully.

3a. No tasks exist:

  1. System returns HTTP 200 with an empty array [].
  2. UI displays an empty-state message.
  3. 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.