Skip to content

#165 ensure ordering of MDBs with Citation first#8772

Merged
kcondon merged 2 commits intodevelopfrom
165-metadatablocks-out-of-order
Jun 8, 2022
Merged

#165 ensure ordering of MDBs with Citation first#8772
kcondon merged 2 commits intodevelopfrom
165-metadatablocks-out-of-order

Conversation

@sekmiller
Copy link
Contributor

@sekmiller sekmiller commented Jun 3, 2022

What this PR does / why we need it: For at least one dataset users are seeing custom metadata blocks appear before the Citation block on dataset view and edit. We always want to display the Citation block first among all mdbs.

Which issue(s) this PR closes:

Closes IQSS/dataverse.harvard.edu#165 When creating, editing and viewing datasets in the NegotiationDataRepository collection, its custom metadatablock appears above the Citation metadatablock

Special notes for your reviewer: This fix relies on the name of the citation block similar to the "isRequired" on the metadata block object. There is no display order field so the sort for custom mdbs is id.

Suggestions on how to test this: verify that the citation block is always rendered first.

Does this PR introduce a user interface change? If mockups are available, please link/include them here: no

Is there a release notes update needed for this change?: no

Additional documentation: none

@pdurbin pdurbin added this to the 5.11 milestone Jun 6, 2022
@pdurbin pdurbin self-assigned this Jun 6, 2022
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

I didn't run the code but this looks fine to me. Metadata blocks should now be sorted by id and since the citation block is added first, it should appear at the top.

We don't have a "display sort" field but if we really need one in the future, we could add it.

I don't know why but Jenkins decided to do another test run despite there only being one commit on this PR. Maybe it's because I fixed the link to the issue that gets closed? The timing is about right. Anyway, the first test run was fine so I think we're good: https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-8772/1/testReport/

@pdurbin pdurbin removed their assignment Jun 7, 2022
@sekmiller
Copy link
Contributor Author

The code doesn't actually rely on the citation block being added first. It relies on the name being citation, similar to the way isRequired is applied to metadata blocks.

@pdurbin
Copy link
Member

pdurbin commented Jun 7, 2022

Right, for the purposes of sorting, it looks for a block called "citation" and gives it a an id of negative one. The rest of the metadata blocks depend on the order in which they were added.

@kcondon kcondon self-assigned this Jun 8, 2022
@kcondon kcondon merged commit daa93ff into develop Jun 8, 2022
@kcondon kcondon deleted the 165-metadatablocks-out-of-order branch June 8, 2022 16:26
@sekmiller sekmiller restored the 165-metadatablocks-out-of-order branch June 8, 2022 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants