Fixed consistency issues with the public statistics
This commit is contained in:
parent
e07d79009a
commit
f86ba70d24
|
@ -1,14 +1,18 @@
|
||||||
package eu.eudat.logic.managers;
|
package eu.eudat.logic.managers;
|
||||||
|
|
||||||
import eu.eudat.criteria.RecentActivityCriteria;
|
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||||
import eu.eudat.data.dao.criteria.*;
|
import eu.eudat.data.dao.criteria.DatasetCriteria;
|
||||||
|
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||||
|
import eu.eudat.data.dao.criteria.OrganisationCriteria;
|
||||||
import eu.eudat.data.dao.entities.DMPDao;
|
import eu.eudat.data.dao.entities.DMPDao;
|
||||||
import eu.eudat.data.dao.entities.DatasetDao;
|
import eu.eudat.data.dao.entities.DatasetDao;
|
||||||
import eu.eudat.data.dao.entities.OrganisationDao;
|
|
||||||
import eu.eudat.data.dao.entities.GrantDao;
|
import eu.eudat.data.dao.entities.GrantDao;
|
||||||
import eu.eudat.data.entities.*;
|
import eu.eudat.data.dao.entities.OrganisationDao;
|
||||||
|
import eu.eudat.data.entities.DMP;
|
||||||
|
import eu.eudat.data.entities.Dataset;
|
||||||
|
import eu.eudat.data.entities.Grant;
|
||||||
|
import eu.eudat.data.entities.UserInfo;
|
||||||
import eu.eudat.data.query.PaginationService;
|
import eu.eudat.data.query.PaginationService;
|
||||||
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
|
|
||||||
import eu.eudat.elastic.entities.Dmp;
|
import eu.eudat.elastic.entities.Dmp;
|
||||||
import eu.eudat.logic.builders.model.models.RecentActivityDataBuilder;
|
import eu.eudat.logic.builders.model.models.RecentActivityDataBuilder;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
|
@ -22,8 +26,6 @@ import eu.eudat.models.data.dashboard.recent.model.RecentDmpModel;
|
||||||
import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest;
|
import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest;
|
||||||
import eu.eudat.models.data.dashboard.searchbar.SearchBarItem;
|
import eu.eudat.models.data.dashboard.searchbar.SearchBarItem;
|
||||||
import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics;
|
import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel;
|
|
||||||
import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
|
||||||
import eu.eudat.models.data.security.Principal;
|
import eu.eudat.models.data.security.Principal;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.types.searchbar.SearchBarItemType;
|
import eu.eudat.types.searchbar.SearchBarItemType;
|
||||||
|
@ -62,17 +64,12 @@ public class DashBoardManager {
|
||||||
public DashBoardStatistics getStatistics() {
|
public DashBoardStatistics getStatistics() {
|
||||||
DashBoardStatistics statistics = new DashBoardStatistics();
|
DashBoardStatistics statistics = new DashBoardStatistics();
|
||||||
|
|
||||||
DataManagmentPlanPublicTableRequest publicTableRequest = new DataManagmentPlanPublicTableRequest();
|
DataManagementPlanCriteria publicCriteria = new DataManagementPlanCriteria();
|
||||||
|
publicCriteria.setIsPublic(true);
|
||||||
DataManagementPlanPublicCriteria publicCriteria = new DataManagementPlanPublicCriteria();
|
publicCriteria.setOnlyPublic(true);
|
||||||
|
|
||||||
publicCriteria.setAllVersions(false);
|
publicCriteria.setAllVersions(false);
|
||||||
|
|
||||||
publicTableRequest.setCriteria(publicCriteria);
|
List<DMP> dmps = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(publicCriteria).toList();
|
||||||
|
|
||||||
publicTableRequest.setQuery(databaseRepository.getDmpDao().asQueryable());
|
|
||||||
|
|
||||||
List<DMP> dmps = publicTableRequest.applyCriteria().toList();
|
|
||||||
|
|
||||||
// DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
// DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||||
OrganisationCriteria organisationCriteria = new OrganisationCriteria();
|
OrganisationCriteria organisationCriteria = new OrganisationCriteria();
|
||||||
|
@ -297,13 +294,11 @@ public class DashBoardManager {
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
for (int i = (recentActivityModels.size() / 2); i < recentActivityModels.size(); i++) {
|
for (int i = (recentActivityModels.size() / 2); i < recentActivityModels.size(); i++) {
|
||||||
RecentActivityModel recentActivityModel = recentActivityModels.remove(i);
|
RecentActivityModel recentActivityModel = recentActivityModels.remove(i);
|
||||||
|
|
||||||
while (pos < recentActivityModels.size()) {
|
while (pos < recentActivityModels.size()) {
|
||||||
pos++;
|
pos++;
|
||||||
if (pos % 2 != 0) {
|
if (pos % 2 != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
recentActivityModels.add(pos, recentActivityModel);
|
recentActivityModels.add(pos, recentActivityModel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue