Problem/Motivation
When an AI Disclosure grade that the grade map names is deleted, the settings form shows that row with nothing selected: the grade is no longer among the select's options, so it falls back to - None -. The next save of the form, for any reason, sends an empty grade for that row, and an empty row is dropped. The mapping is gone without the site builder being told, and creating the grade again with the same ID does not bring it back.
Found in the review of 1.0.0-alpha1. The empty select was measured; the dropped row follows from GradeMapTable::toConfig(), which skips a row without a grade (that is how the spare "add another" row is ignored).
Steps to reproduce
- Map a digitalSourceType to two grades on Configuration → Content authoring → Content credentials and save.
- Delete one of those grades in AI Disclosure.
- Open the settings form again: that row shows - None -.
- Change anything else, for example the read ceiling, and save: the row is gone from
content_credentials.settings:grade_map.
Proposed resolution
Give such a row the missing grade as an extra option on that row only, labelled "id (no longer exists)" and selected, so a save keeps the row as it was. Recreating the grade makes it work again. Choosing - None - still removes the row on purpose. A new mapping cannot pick a missing grade.
Not in this issue: a status-report warning (a read that meets such a row is already logged), and removing rows when a grade is deleted (the settings are simple config and cannot depend on a grade).
Remaining tasks
- Tests, then the fix.
User interface changes
On the settings form, a grade-map row whose grade was deleted shows "id (no longer exists)" instead of - None -.
Comments
Comment #4
maurice1969 commentedCommitted to 1.0.x as b4fa345; CI green. A row whose grade no longer exists now shows "id (no longer exists)" and is saved as it was. It will be in 1.0.0-alpha2.