From c9b707a5447fbcc1feec0db2f74ca8faf0eebf26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 2 Aug 2026 01:50:27 +0300 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=90=20admit=20refresh-from-ban?= =?UTF-8?q?k=20can=20lose=20the=20subject=20race?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/web/exams/questions.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f2b11e..bc9943f 100644 --- a/README.md +++ b/README.md @@ -747,7 +747,7 @@ window filtering, before paging; negative values are a `400` naming the field. | DELETE | `/exams/{id}/questions/{qid}` | teacher | Delete a question + its answers (course manager; frozen once attempted) | | POST | `/exams/{id}/questions/from-bank/{bid}` | teacher | Instantiate a **bank question** into this exam — copies it to a fresh exam-scoped question (new id, own images + answers; records the template in `source_bank`); body `{subject_id}` retags it against the course's subjects (`400` cross-course; course manager; `409` once attempted) | | POST | `/exams/{id}/questions/{qid}/to-bank` | teacher | Save an existing exam question into the school **question bank** — copies it to a detached bank row (new id, own images; records the origin exam in `source_exam`); the source question is untouched (course manager) | -| POST | `/exams/{id}/questions/{qid}/refresh-from-bank` | teacher | Re-copy the template's **current** content over this question — text, points, kind, choices (with the template's choice ids), `correct`, illustration and option pictures; keeps the question's own id, exam, `subject` and provenance links, and overwrites any local edit. `400` if it never came from the bank (or the template is gone), `404` if the template is not visible to the caller, `409` once attempts exist (course manager) | +| POST | `/exams/{id}/questions/{qid}/refresh-from-bank` | teacher | Re-copy the template's **current** content over this question — text, points, kind, choices (with the template's choice ids), `correct`, illustration and option pictures; keeps the question's own id, exam, `subject` and provenance links, and overwrites any local edit. `400` if it never came from the bank (or the template is gone), `404` if the template is not visible to the caller, `409` once attempts exist or if the question's subject was re-tagged since the read — nothing written, re-read and retry (course manager) | | GET | `/exams/{id}/attempt/questions` | student | The sitting view: no `correct`, own answers embedded, image metadata included (requires enrollment + an attempt) | | POST | `/exams/{id}/questions/{qid}/image` | teacher | Attach/replace the question's illustration: `multipart/form-data`, one `file` part — raster images only (`png`/`jpeg`/`webp`/`gif`), ≤ `max_file_bytes` (course manager; frozen once attempted) | | GET | `/exams/{id}/questions/{qid}/image` | student | The illustration bytes (course manager anytime; students enrolled + attempt started) | diff --git a/src/web/exams/questions.rs b/src/web/exams/questions.rs index 5501512..3e7e22d 100644 --- a/src/web/exams/questions.rs +++ b/src/web/exams/questions.rs @@ -617,7 +617,7 @@ pub(crate) async fn question_from_bank( (status = 401, description = "Not authenticated", body = ErrorResponse), (status = 403, description = "Not the course creator or an assigned teacher (and not a manager/admin)", body = ErrorResponse), (status = 404, description = "No such exam, no such question in it, or no bank template the caller may see", body = ErrorResponse), - (status = 409, description = "Attempts have started — questions are frozen", body = ErrorResponse), + (status = 409, description = "Attempts have started — questions are frozen, or the question's subject was re-tagged since the caller read it — nothing was written, re-read and retry", body = ErrorResponse), ), )] pub(crate) async fn question_refresh_from_bank(