Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix positions of learning goals when new ones are added or deleted #54410

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

kobryan0619
Copy link
Contributor

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...

@kobryan0619 kobryan0619 requested a review from a team October 23, 2023 17:03
@@ -110,7 +110,7 @@ function removeNewIds(keyConceptList) {
function resetPositionsOfLearningGoals(keyConceptList) {
let position = 1;
keyConceptList.forEach(keyConcept => {
if (keyConceptList._delete) {
if (keyConcept._destroy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a typo fix or is there a difference between delete and destroy here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question! A bit of both... I think it was a typo initially. When we remove a LearningGoal we add a _destroy property (found here).

I did do some research on delete vs destroy(because I cannot remember what the reasoning was for using _destroy in the first place), and it seems like we do want destroy because we want to remove the associated evidenceLevels as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Destroy makes sense to me as well here.

@kobryan0619 kobryan0619 requested review from bethanyaconnor and a team and removed request for bethanyaconnor October 23, 2023 20:23
@kobryan0619 kobryan0619 merged commit 5ab1206 into staging Oct 25, 2023
2 checks passed
@kobryan0619 kobryan0619 deleted the kaitie/fix-positions-of-learning-goals branch October 25, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants