feat(marking): minimum-viable in-app rubric editor#59
Open
hyperpolymath wants to merge 1 commit into
Open
Conversation
Adds a /rubric-editor route where tutors can edit any rubric pack (built-in or disk) as raw .exs source, save it to priv/rubrics/, and have the composer pick up the new pack on the very next interaction. Approach: minimum viable - No structured form. The pack is shown as its inspected .exs source. - Edit the source, change the filename, click "Save & reload". - Validation leans on the runtime-load layer (PR #56): a broken save is reported via flash but does not remove the working rubrics. - "Revert" reloads the on-disk / built-in version. - "Delete on disk" removes the .exs file; the built-in (if any) is used as the fallback. New modules - EtmaHandler.Marking.RubricSerialiser to_source/1 -> inspect + SPDX header write_to_disk/3 -> writes <dir>/<filename>.exs (appends .exs if missing); returns {:ok, path} or {:error, ...} delete_from_disk/2 -> removes the .exs file - EtmaHandlerWeb.RubricEditorLive The LiveView itself: dropdown to load any existing pack, textarea with the source, filename input, four buttons (Load / Revert / Delete / Save & reload). Router - new live "/rubric-editor", RubricEditorLive, :index Composer integration - "Edit rubrics ->" link next to the existing "Reload rubrics" button so tutors discover the editor from the composer. Tests (68 total, 8 new — Serialiser only; the LiveView itself needs Phoenix.LiveViewTest which isn't available in this sandbox) - to_source round-trips through Code.eval_string to the same struct - to_source emits the SPDX header - write_to_disk writes <dir>/<filename>.exs - write_to_disk appends .exs only when missing - write_to_disk returns :no_rubric_dir when nothing is resolvable - written file is loadable by RubricRegistry.reload (round-trip) - delete_from_disk removes the file - delete_from_disk returns :enoent for missing files Out of scope (follow-ups) - Structured form (add/remove components, indicators, questions via UI rather than raw source editing) - Validation preview before save (currently relies on registry skip) - Conflict detection when overwriting a disk file that shadows a built-in (just works — disk wins) Verified locally via standalone elixirc + ExUnit (68/0). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a `/rubric-editor` route where tutors can edit any rubric pack (built-in or disk) as raw `.exs` source, save it to `priv/rubrics/`, and have the composer pick up the new pack on the very next interaction.
Approach: minimum viable
New modules
Composer integration
Tests
Out of scope (future follow-ups)
Test plan
Generated with Claude Code.