Move the lessons to a temporary lesson group so that moving lesson groups works #39353
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.
We got a report that moving the last lesson group up was giving errors about legacy script levels not being allowed in a bunch of lessons. The issue is a follow up issue to the fix in this PR: #39255.
Because the fix in the previous PR moved all the lessons to the last lesson group when you moved the last lesson group up it deleted all the lessons that had not been set up in previous lesson groups and that resulted in the chain of issues listed in that previous PR.
To fix this we add a temporary lesson group to hold all the lessons and put it at the end of the script. This temp lesson group will get deleted by these lines in
add_script
once everything else in the script has been set up.code-dot-org/dashboard/app/models/script.rb
Lines 1057 to 1060 in 3007647
Testing story
Added a test to make sure you could move the last lesson group in a migrated script up without lessons getting deleted.
Follow-up work
We still want to move off of this system going forward but after our April deadline.
PR Checklist: