Fix infinite loop in home page when total number of results is less than the page size

This commit is contained in:
Konstantinos Triantafyllou 2023-04-28 16:10:32 +03:00
parent e84398f667
commit 50169222c7
5 changed files with 11 additions and 11 deletions

View File

@ -44,17 +44,17 @@ export class LoggingService {
switch (level) {
case LogLevel.Debug:
// tslint:disable-next-line:no-console
console.debug(objects.join(', '));
// console.debug(objects.join(', '));
break;
case LogLevel.Info:
// tslint:disable-next-line:no-console
console.info(objects.join(', '));
// console.info(objects.join(', '));
break;
case LogLevel.Warning:
console.warn(objects.join(', '));
// console.warn(objects.join(', '));
break;
case LogLevel.Error:
console.error(objects.join(', '));
// console.error(objects.join(', '));
break;
}
});

View File

@ -122,7 +122,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
this.datasetDrafts = response.data;
this.totalCount = response.totalCount;
this.totalCountDraftDatasets.emit(this.datasetDrafts.length);
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) {
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "drafts", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;

View File

@ -151,7 +151,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}
});
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize) {
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;
@ -186,7 +186,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
}
});
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize) {
if(this.allRecentActivities.length > 0 && this.allRecentActivities.length < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "recent", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;

View File

@ -122,7 +122,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.datasetActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDatasets.emit(this.datasetActivities.length)
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) {
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;
@ -146,7 +146,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.datasetActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDatasets.emit(this.datasetActivities.length);
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) {
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "datasets", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;

View File

@ -133,7 +133,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.dmpActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDmps.emit(this.dmpActivities.length);
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) {
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;
@ -182,7 +182,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.dmpActivities = response.data;
this.totalCount = response.totalCount;
this.totalCountDmps.emit(this.dmpActivities.length);
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize) {
if(this.totalCount > 0 && this.totalCount < this.page*this.pageSize && this.page > 1) {
let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value };
if(this.formGroup.get("like").value) {
queryParams['keyword'] = this.formGroup.get("like").value;