Fix minor issue with DMP criteria

This commit is contained in:
George Kalampokis 2020-08-03 16:56:36 +03:00
parent 9b837a27a8
commit cd5295437b
2 changed files with 18 additions and 13 deletions

View File

@ -52,13 +52,12 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
if (criteria.getStatus() != null) {
if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
query.where((builder, root) -> builder.and(builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()), builder.notEqual(root.get("isPublic"), true)));
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()));
} else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
}
}
if (criteria.getIsPublic())
query.where(((builder, root) -> builder.equal(root.get("isPublic"), true)));
query.where(((builder, root) -> builder.equal(root.get("isPublic"), criteria.getIsPublic())));
/*if (criteria.getRole() != null) {
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())) {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.OWNER.getValue()));

View File

@ -392,16 +392,22 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
}
setPublicCriteria(formGroup?: FormGroup): void {
if (formGroup && formGroup.get('status').value == 2) {
if (!isNullOrUndefined(formGroup)) {
if (formGroup.get('status').value == 2) {
this.criteria.status = 1;
this.criteria.isPublic = true;
} else {
this.criteria.isPublic = false;
}
}
this.criteria.onlyPublic = this.isPublic;
if (this.isPublic) {
this.criteria.isPublic = true;
} else {
this.criteria.isPublic = false;
}
// } else {
// this.criteria.isPublic = false;
// }
}
hasScrollbar(): boolean {