fix positions of learning goals when new ones are added or deleted #54410
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.
When curriculum writers are editing a rubric, the
position
of a learning goal may change as they add or delete learning goals for a rubric. In the past, the positions were always increasing but not necessarily sequential (ex. they would have positions of 1, 4, 6, 7, BUT ideally those positions should be 1, 2, 3, 4.Note that currently Curriculum Writers cannot reorder learning goals in the UI themselves, but this work would also set-up this feature in the future.
PR fixes this ordering issue in the back end.
Testing story
I did not modify any tests for this since this function is only called when saving to the back end. If we think a test needs to be added, i'd love to see how this is done in similar helper files. I searched our codebase and couldn't find a good similar example...