Fix issue with related datasets on dashboard

This commit is contained in:
George Kalampokis 2021-12-03 16:49:23 +02:00
parent b2825c8369
commit de4c430d91
1 changed files with 4 additions and 2 deletions

View File

@ -325,9 +325,11 @@ public class DashBoardManager {
recentActivityModels.addAll(dmps1.stream().map(dmp -> {
DatasetCriteria datasetCriteria1 = new DatasetCriteria();
datasetCriteria1.setDmpIds(Collections.singletonList(dmp.getId()));
datasetCriteria1.setAllVersions(false);
if (isAuthenticated) {
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria1, principal.getId()));
} else {
datasetCriteria1.setIsPublic(true);
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria1));
}
return new RecentDmpModel().fromDataModel(dmp);
@ -447,14 +449,14 @@ public class DashBoardManager {
roles.add(1);
datasetItems = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getAuthenticated(datasetItems, userInfo, roles);
}
Long maxDatasets = datasetItems.count();
Long maxDatasets = datasetItems.distinct().count();
DatasetTableRequest datasetTableRequest = new DatasetTableRequest();
datasetTableRequest.setOffset(0);
datasetTableRequest.setLength(3);
Set<Dataset> datasetsSet = new LinkedHashSet<>();
try {
datasetItems = PaginationManager.applyPaging(datasetItems, datasetTableRequest);
List<Dataset> datasets = datasetItems.toList();
List<Dataset> datasets = datasetItems.distinct().toList();
datasetsSet.addAll(datasets);
for (int i = 0; i < maxDatasets - datasets.size(); i++) {
Dataset fakedataset = new Dataset();