Skip to content

Commit

Permalink
Merge pull request #10969 from Recherche-Data-Gouv/10968-order-subfie…
Browse files Browse the repository at this point in the history
…lds-version-difference

Ordering subfields while displaying dataset version differences
  • Loading branch information
ofahimIQSS authored Nov 6, 2024
2 parents 5d392b6 + b3147a0 commit e208eed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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

0 comments on commit e208eed

Please sign in to comment.