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

Ordering subfields while displaying dataset version differences #10969

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release-notes/10969-order-subfields-version-difference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bug Fix:
In order to facilitate the comparison between the draft version and the published version of a dataset, a sort on subfields has been added (#10969)
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ public DatasetVersionDifference(DatasetVersion newVersion, DatasetVersion origin
getReplacedFiles();
initDatasetFilesDifferencesList();

//Sort within blocks by datasetfieldtype dispaly order then....
//sort via metadatablock order - citation first...
//Sort within blocks by datasetfieldtype display order
for (List<DatasetField[]> blockList : detailDataByBlock) {
Collections.sort(blockList, (DatasetField[] l1, DatasetField[] l2) -> {
DatasetField dsfa = l1[0]; //(DatasetField[]) l1.get(0);
Expand All @@ -163,6 +162,17 @@ public DatasetVersionDifference(DatasetVersion newVersion, DatasetVersion origin
return Integer.valueOf(a).compareTo(b);
});
}
//Sort existing compoundValues by datasetfieldtype display order
for (List<DatasetField[]> blockList : detailDataByBlock) {
for (DatasetField[] dfarr : blockList) {
for (DatasetField df : dfarr) {
for (DatasetFieldCompoundValue dfcv : df.getDatasetFieldCompoundValues()) {
Collections.sort(dfcv.getChildDatasetFields(), DatasetField.DisplayOrder);
}
}
}
}
//Sort via metadatablock order
Collections.sort(detailDataByBlock, (List l1, List l2) -> {
DatasetField dsfa[] = (DatasetField[]) l1.get(0);
DatasetField dsfb[] = (DatasetField[]) l2.get(0);
Expand Down
Loading