forge
Explore
Log in

Don't you dare go Hollow

📐 admit refresh-from-bank can lose the subject race

Browse files at this commit

c9b707a5447fbcc1feec0db2f74ca8faf0eebf26Ahmet Kaan GümüşParent: 646ec10
  • docs
    • 📐 admit refresh-from-bank can lose the subject race
Show full message
docs: 📐 admit refresh-from-bank can lose the subject race
README.mdmodified+1 -1
@@ -747,7 +747,7 @@ window filtering, before paging; negative values are a `400` naming the field.
747747 | DELETE | `/exams/{id}/questions/{qid}` | teacher | Delete a question + its answers (course manager; frozen once attempted) |
748748 | 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) |
749749 | 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) |
750-| 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) |
750+| 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) |
751751 | GET | `/exams/{id}/attempt/questions` | student | The sitting view: no `correct`, own answers embedded, image metadata included (requires enrollment + an attempt) |
752752 | 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) |
753753 | GET | `/exams/{id}/questions/{qid}/image` | student | The illustration bytes (course manager anytime; students enrolled + attempt started) |
src/web/exams/questions.rsmodified+1 -1
@@ -617,7 +617,7 @@ pub(crate) async fn question_from_bank(
617617 (status = 401, description = "Not authenticated", body = ErrorResponse),
618618 (status = 403, description = "Not the course creator or an assigned teacher (and not a manager/admin)", body = ErrorResponse),
619619 (status = 404, description = "No such exam, no such question in it, or no bank template the caller may see", body = ErrorResponse),
620- (status = 409, description = "Attempts have started — questions are frozen", body = ErrorResponse),
620+ (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),
621621 ),
622622 )]
623623 pub(crate) async fn question_refresh_from_bank(