Skip to content

fix(api): add Submissions.unsubmit() to clear submitted_at with explicit null - #78

Merged
ngjunsiang merged 1 commit into
mainfrom
bugfix/submissions-unsubmit
Oct 4, 2026
Merged

ngjunsiang merged 1 commit into
mainfrom
bugfix/submissions-unsubmit

Conversation

@nycomp

@nycomp nycomp commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack (merge in order): #78 -> #79 -> #80 -> #81 -> #82 -> #85
This is 1 of 6. Base is the branch of the PR below; each PR's diff shows only its own commit, and GitHub retargets it to main when the one below merges. Branches rebuilt on current main (9563443) — content unchanged from the original commits.

Summary

  • Adds Submissions.Submission.unsubmit(), which PATCHes {"submitted_at": null} — the only body the server interprets as clearing submitted_at (campus/api/resources/submission.py:60).
  • update() cannot express this: its None means "omit the field", so update(submitted_at=None) raised the client's own "At least one field" ValueError. campus-classroom's unsubmit was inexpressible through the client.
  • Mirrors the existing submit() action; unsubmit keeps update()'s contract unchanged (pinned by tests).

Tests

tests/unit/test_submissions_unsubmit.py (same mock-client pattern as test_nested_resources.py):

  • unsubmit PATCHes {"submitted_at": None} to /api/v1/submissions/<id>/
  • update() still raises ValueError with no fields, and still sets a timestamp string

Full suite: 149 passed (146 existing + 3 new).

Fixes #74

…cit null

The server only clears a submission's submitted_at for an explicit
null in the PATCH body (campus/api/resources/submission.py), but
update() treats None as "omit the field" — unsubmit was inexpressible.
unsubmit() PATCHes {"submitted_at": null} directly, mirroring submit().

Fixes #74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(api): Submissions.update() cannot send submitted_at null — unsubmit is inexpressible

2 participants