fix(exam): blank total only for absent AND unmarked; flip status on mark
A roster student starts 'absent' and a direct mark would otherwise still show a blank total. Now total is blank only when absent with no marks; recording a mark advances the submission out of absent/unmatched to 'marking'. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
a1d297ac30
commit
62234dbbcb
@@ -233,6 +233,17 @@ def test_upsert_mark_derives_batch_and_roundtrips():
|
||||
assert sum(1 for m in store["mark_entries"] if m["id"] == "mk-1") == 1
|
||||
|
||||
|
||||
def test_upsert_mark_flips_absent_submission_to_marking():
|
||||
store = _batch_with_cohort() # sub2 starts 'absent'
|
||||
c = make_client(store)
|
||||
c.put("/api/exam/marks/mk-2", json={"submission_id": "sub2", "question_id": "q1", "awarded_marks": 2})
|
||||
sub2 = next(s for s in store["student_submissions"] if s["id"] == "sub2")
|
||||
assert sub2["status"] == "marking"
|
||||
# results now show a real total for the (formerly absent) marked student
|
||||
res = {r["submission_id"]: r for r in c.get("/api/exam/batches/b1/results").json()["results"]}
|
||||
assert res["sub2"]["total"] == 2
|
||||
|
||||
|
||||
def test_upsert_mark_submission_404():
|
||||
c = make_client(_batch_with_cohort())
|
||||
assert c.put("/api/exam/marks/mk-x", json={"submission_id": "nope", "question_id": "q1", "awarded_marks": 1}).status_code == 404
|
||||
|
||||
Reference in New Issue
Block a user