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

Don't scramble references when creating a new project version #2271

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented Aug 8, 2024

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.

Reference (and PublishedReference) objects have an "order" field which
is supposed to determine the order the references are displayed.

This field is not set or used consistently.  Try to make the situation
less bad for new active projects, by creating references in order (so
that the order of their "id" will match the order of their "order")
and also copy the "order" from the published project.
@bemoody
Copy link
Collaborator Author

bemoody commented Aug 8, 2024

Oh yeah, and this also won't fix cases where the published references have no order (presumably because they were copied from a previous version and never edited, and meaning that "order they are displayed on the published project page" is not fixed.)

@tompollard
Copy link
Member

Thanks Benjamin!

@tompollard tompollard merged commit bca15af into dev Aug 8, 2024
8 checks passed
@tompollard tompollard deleted the bm/copy-ref-order branch August 8, 2024 23:01
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.

2 participants