feat(web): import a single assignment from YAML#103
Merged
Conversation
Add importAssignmentYAML(course, yaml): upsert one assignment into an existing course from a YAML snippet in the same keyed form it has in a course file (the single top-level key is the assignment name), so a block can be copy-pasted straight out of a course YAML instead of re-importing the whole course. - app.ImportAssignmentYAML merges the block into the stored course body, decodes the whole course via config.DecodeCourseBody, rejects inline signKeys, validates the assignment against the real resolver (a concrete one that does not resolve is rejected; an abstract base is fine), then persists — re-marshalling the course YAML, exactly like SetAssignment. - graph: importAssignmentYAML mutation + resolver. - tests: upsert keeps existing assignments; rejects multiple top-level keys and invalid names. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Beantwortet die Frage „kann ich einzelne Assignments nicht importieren?" — jetzt ja.
Neue Mutation
importAssignmentYAML(course, yaml): fügt ein einzelnes Assignment per Upsert in einen bestehenden Kurs ein, aus einem YAML-Schnipsel in derselben Form wie in einer Kurs-Datei (der oberste Schlüssel ist der Assignment-Name). So lässt sich ein Block direkt aus einer Kurs-YAML kopieren, statt den ganzen Kurs neu zu importieren.Was drin ist
app.ImportAssignmentYAML: merged den Block in den gespeicherten Kurs-Body, dekodiert den ganzen Kurs überconfig.DecodeCourseBody, lehnt inlinesignKeys ab, validiert das Assignment über den echten Resolver (ein konkretes, nicht auflösbares wird abgelehnt; eine abstrakte Basis ist ok) und persistiert — mit Neu-Marshalling der Kurs-YAML, genau wiesetAssignment.importAssignmentYAML-Mutation + Resolver.GraphQL
Verifikation (lokal grün)
go build,go vet(+ integration),go test ./...,golangci-lint— alle sauber.Danach: GUI-PR mit einem „Assignment aus YAML importieren"-Feld auf der Kursseite.
🤖 Generated with Claude Code