Calculation history #7

Open
opened 2026-11-21 02:25:13 +00:00 by lab-admin · 1 comment
Owner

Keep a short history of successful calculations.

Requirements

  • The server keeps the last 10 successful calculations in memory (newest first).
  • GET /api/history returns 200 {"items": [{"a": <number>, "b": <number or null>, "op": "<op>", "result": <number>}]}.
  • DELETE /api/history clears it and returns 204.
  • Failed calculations are not recorded.
  • UI: a "History" list under the calculator that refreshes after each = (and after √), and a "Clear history" button.
  • Tests for the history module/API (ordering, limit of 10, clearing, errors not recorded) and the page.

Acceptance criteria

  1. After 2+3 and 6*7, GET /api/history lists 6*7=42 first and 2+3=5 second.
  2. After 12 calculations only the newest 10 are returned.
  3. A failed calculation (division by zero) is not in the history.
  4. DELETE /api/history returns 204 and the history is empty afterwards.
  5. The page shows the history list and a Clear history button.
Keep a short history of successful calculations. ## Requirements - The server keeps the last 10 successful calculations in memory (newest first). - `GET /api/history` returns `200 {"items": [{"a": <number>, "b": <number or null>, "op": "<op>", "result": <number>}]}`. - `DELETE /api/history` clears it and returns `204`. - Failed calculations are not recorded. - UI: a "History" list under the calculator that refreshes after each `=` (and after `√`), and a "Clear history" button. - Tests for the history module/API (ordering, limit of 10, clearing, errors not recorded) and the page. ## Acceptance criteria 1. After `2+3` and `6*7`, `GET /api/history` lists `6*7=42` first and `2+3=5` second. 2. After 12 calculations only the newest 10 are returned. 3. A failed calculation (division by zero) is not in the history. 4. `DELETE /api/history` returns 204 and the history is empty afterwards. 5. The page shows the history list and a Clear history button.
Collaborator

Aira · queued

Aira picked up this task. Branch aira/7-calculation-history.

**Aira · queued** Aira picked up this task. Branch `aira/7-calculation-history`.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/web-calculator-2#7
No description provided.