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())); query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
if (criteria.getStatus() != null) { if (criteria.getStatus() != null) {
if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) { 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()) { } else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
query.where((builder, root) -> builder.equal(root.get("status"), 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"), criteria.getIsPublic())));
query.where(((builder, root) -> builder.equal(root.get("isPublic"), true)));
/*if (criteria.getRole() != null) { /*if (criteria.getRole() != null) {
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())) { 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())); 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 { setPublicCriteria(formGroup?: FormGroup): void {
if (formGroup && formGroup.get('status').value == 2) { if (!isNullOrUndefined(formGroup)) {
this.criteria.isPublic = true; if (formGroup.get('status').value == 2) {
this.criteria.status = 1;
this.criteria.isPublic = true;
} else {
this.criteria.isPublic = false;
}
} }
this.criteria.onlyPublic = this.isPublic; this.criteria.onlyPublic = this.isPublic;
if (this.isPublic) { if (this.isPublic) {
this.criteria.isPublic = true; this.criteria.isPublic = true;
} else {
this.criteria.isPublic = false;
} }
// } else {
// this.criteria.isPublic = false;
// }
} }
hasScrollbar(): boolean { hasScrollbar(): boolean {
@ -467,17 +473,17 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
public setDashboardTourDmpText(): void { public setDashboardTourDmpText(): void {
this.dmpText = this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' + this.dmpText = this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' +
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' + this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' + this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
this.language.instant('DMP-LISTING.GET-IDEA'); this.language.instant('DMP-LISTING.GET-IDEA');
this.dashboardTour.steps[0].title = this.dmpText; this.dashboardTour.steps[0].title = this.dmpText;
} }
public setDashboardTourDatasetText(): void { public setDashboardTourDatasetText(): void {
this.datasetText = this.language.instant('DATASET-LISTING.TEXT-INFO') + this.datasetText = this.language.instant('DATASET-LISTING.TEXT-INFO') +
this.language.instant('DATASET-LISTING.LINK-PUBLIC-DATASETS') + ' ' + this.language.instant('DATASET-LISTING.LINK-PUBLIC-DATASETS') + ' ' +
this.language.instant('DATASET-LISTING.TEXT-INFO-REST') + '\n\n' + this.language.instant('DATASET-LISTING.TEXT-INFO-REST') + '\n\n' +
this.language.instant('DATASET-LISTING.TEXT-INFO-PAR'); this.language.instant('DATASET-LISTING.TEXT-INFO-PAR');
this.dashboardTour.steps[1].title = this.datasetText; this.dashboardTour.steps[1].title = this.datasetText;
} }