Hide grants without any active dmp
This commit is contained in:
parent
95f8eb15c9
commit
b76a787972
|
@ -14,6 +14,7 @@ public class GrantCriteria extends Criteria<Grant> {
|
||||||
private String funderId;
|
private String funderId;
|
||||||
private String funderReference;
|
private String funderReference;
|
||||||
private String exactReference;
|
private String exactReference;
|
||||||
|
private boolean isActive;
|
||||||
|
|
||||||
public Date getPeriodStart() {
|
public Date getPeriodStart() {
|
||||||
return periodStart;
|
return periodStart;
|
||||||
|
@ -71,4 +72,12 @@ public class GrantCriteria extends Criteria<Grant> {
|
||||||
public void setExactReference(String exactReference) {
|
public void setExactReference(String exactReference) {
|
||||||
this.exactReference = exactReference;
|
this.exactReference = exactReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
isActive = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ public class GrantDaoImpl extends DatabaseAccess<Grant> implements GrantDao {
|
||||||
if (criteria.isPublic()) {
|
if (criteria.isPublic()) {
|
||||||
query.where((builder, root) -> builder.equal(root.join("dmps").get("status"), DMP.DMPStatus.FINALISED.getValue())).distinct();
|
query.where((builder, root) -> builder.equal(root.join("dmps").get("status"), DMP.DMPStatus.FINALISED.getValue())).distinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (criteria.isActive()) {
|
||||||
|
query.where((builder, root) -> builder.notEqual(root.join("dmps").get("status"), DMP.DMPStatus.DELETED.getValue())).distinct();
|
||||||
|
}
|
||||||
if (criteria.getFunderId() != null && !criteria.getFunderId().trim().isEmpty())
|
if (criteria.getFunderId() != null && !criteria.getFunderId().trim().isEmpty())
|
||||||
query.where((builder, root) -> builder.equal(root.get("funder").get("id"), UUID.fromString(criteria.getFunderId())));
|
query.where((builder, root) -> builder.equal(root.get("funder").get("id"), UUID.fromString(criteria.getFunderId())));
|
||||||
if (criteria.getFunderReference() != null && !criteria.getFunderReference().isEmpty())
|
if (criteria.getFunderReference() != null && !criteria.getFunderReference().isEmpty())
|
||||||
|
|
|
@ -135,6 +135,8 @@ public class DashBoardManager {
|
||||||
dataManagementPlanCriteria.setAllVersions(false);
|
dataManagementPlanCriteria.setAllVersions(false);
|
||||||
GrantCriteria grantCriteria = new GrantCriteria();
|
GrantCriteria grantCriteria = new GrantCriteria();
|
||||||
|
|
||||||
|
grantCriteria.setActive(true);
|
||||||
|
|
||||||
List<Integer> roles = new LinkedList<>();
|
List<Integer> roles = new LinkedList<>();
|
||||||
List<Dmp> finalDmps = dmps;
|
List<Dmp> finalDmps = dmps;
|
||||||
CompletableFuture dmpFuture = dataManagementPlanRepository.getAuthenticated((dmps != null && !dmps.isEmpty()) ? dataManagementPlanRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList()))) : dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles).distinct().countAsync()
|
CompletableFuture dmpFuture = dataManagementPlanRepository.getAuthenticated((dmps != null && !dmps.isEmpty()) ? dataManagementPlanRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList()))) : dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles).distinct().countAsync()
|
||||||
|
|
Loading…
Reference in New Issue