Don't scramble references when creating a new project version #2271
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 a new project version is created, references are copied from the latest published version.
Copy these references in the order they are displayed on the published project page.
Reference "id"s must be in sequence (this is what the
order_by('order')
does); this determines the order the references will appear in the Project Content page.Reference "order"s must be in sequence (this is what the
order=p_reference.order
does); this determines the order the references will appear in the Project Preview page and ultimately in the published project.This pull request does not fix any existing projects. This pull request only affects what will happen when you click the "new version" button. Many existing active and published projects have scrambled lists of references. This pull request does not and cannot fix them.
This pull request also does not fix the fact that for some active projects, the order shown in the Content page doesn't match the Preview page. If the two pages don't match, that's actually a good sign because in that case we know something is wrong.
This pull request also does not fix the lack of database constraints (issue #2137), which we can't fix until we have a way to migrate the broken projects. Doing nothing is better than doing the wrong thing.