NameCdError: refine input handling and feedback for empty due-to lists#640
NameCdError: refine input handling and feedback for empty due-to lists#640Copilot wants to merge 18 commits into
Conversation
Agent-Logs-Url: https://github.com/fmidue/modelling-tasks/sessions/f638623e-24b6-4cf5-8179-42cb2d59de42 Co-authored-by: jvoigtlaender <5853832+jvoigtlaender@users.noreply.github.com>
dueTo = []
|
@horriblename, can you check this has the desired behavior; and possibly refactor the |
|
There will probably be a remaining issue, that could also be addressed by some special-casing here? Let's say an instance of this task type actually has as correct answer that there wasn't any error, hence no relationship should be named as problematic. (Such an instance could be a hand-written one.) Now let's say the student claims that there is an error and indeed names some relationships as problematic. The correct answer would be no-change, though. It seems at current the student would nevertheless get some feedback related to how deleting their given relationships affects the class diagram, even though that's irrelevant since the class diagram was actually correct as given originally. |
|
(I haven't looked at the second comment, will do so later) |
|
currently in the Quiz version, an empty |
|
The parser fix seems a good idea. |
|
Maybe also the case that students don't give a |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1603bdcd7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Suppresses misleading output in NameCdError when a learner submits an empty dueTo list: the "chosen relationships" feedback block and the post-grading "diagram after removal" rendering are no longer produced. The diff also makes the due-to field optional in the answer JSON parser (defaults to []).
Changes:
- Guard the relationship feedback paragraph +
multipleChoiceSyntaxcall innameCdErrorSyntaxbehindunless (null (dueTo x)). - Guard the resulting-class-diagram explanation/rendering in
nameCdErrorEvaluationbehindunless (null (dueTo x) || all not solutionDueTo). - Replace
deriveJSONwithderiveToJSONand add a hand-writtenFromJSONinstance that makesdue-tooptional with default[]; addOverloadedStringsand broadenData.Yamlimports.
| instance FromJSON NameCdErrorAnswer where | ||
| parseJSON = withObject "NameCdErrorAnswer" $ \v -> NameCdErrorAnswer | ||
| <$> v .: "reason" | ||
| <*> v .:? "due-to" .!= [] |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Do it with the "deriving FromJSON with the same options and then post-processing with a default" suggestion.
There was a problem hiding this comment.
Implemented: NameCdErrorAnswer now derives FromJSON with the same fieldLabelModifier = upperToDash options, and missing/null due-to is defaulted to [] in a post-processing step before parsing. Commit: 4cf8816.
dueTo = []dueTo = []
dueTo = []…e-to Agent-Logs-Url: https://github.com/fmidue/modelling-tasks/sessions/d8206729-8b48-44de-b258-e776f677ac34 Co-authored-by: jvoigtlaender <5853832+jvoigtlaender@users.noreply.github.com>
Agent-Logs-Url: https://github.com/fmidue/modelling-tasks/sessions/d8206729-8b48-44de-b258-e776f677ac34 Co-authored-by: jvoigtlaender <5853832+jvoigtlaender@users.noreply.github.com>
|
@horriblename, can you check whether the changes in the range https://github.com/fmidue/modelling-tasks/pull/640/changes/4e9b14c0d53557837592712ab517bd13939702ba..d0a51bda012ff47ea2314cc147ed841a5fd12e5b achieve the same as you had via the hand-written instance? |
|
yes, they behave the same |
NameCdErrorproduced confusing feedback when learners submitted an empty relationship list: a “chosen relationships” feedback section with no meaningful content, and a rendered “diagram after removal” that was just the unchanged original diagram.This change keeps empty selections valid but removes those misleading outputs for the empty-list case.
Additionally, based on review feedback, answer parsing was adjusted so empty quiz input forms are accepted consistently:
NameCdErrorAnswernow derivesFromJSONwith the samefieldLabelModifier = upperToDashoptions asToJSON.Parsing now post-processes decoded input so
due-tois treated as[]when it is missing ornull.This preserves encoder/decoder consistency and avoids hardcoded field-name drift.
Description
nameCdErrorSyntaxdueTocheck.nameCdErrorEvaluationdueTocheck.NameCdErrorAnswerparsingFromJSONwith the same options asToJSON.nulldue-tois normalized to[]before parsing.due-to: [],due-to: null, and omitteddue-toall behave as empty selection.