diff --git a/src/app/portal/components/single/single-publication/single-publication.component.ts b/src/app/portal/components/single/single-publication/single-publication.component.ts index cdfaa7203..42c85c798 100644 --- a/src/app/portal/components/single/single-publication/single-publication.component.ts +++ b/src/app/portal/components/single/single-publication/single-publication.component.ts @@ -631,12 +631,17 @@ export class SinglePublicationComponent } filterData() { - // Helper function to check if the field exists and has data + // Helper function to check if the field exists and has valid data const checkEmpty = (item: { field: string }) => { return UtilityService.stringHasContent( this.responseData.publications[0][item.field] ); }; + // Helper function to check if the field has some data + const checkIfValueExists = (item: { field: string }) => { + return this.responseData.publications[0][item.field]?.length > 0; + }; + // Filter all the fields to only include properties with defined data this.infoFields = this.infoFields.filter((item) => checkEmpty(item)); // this.authorFields = this.authorFields.filter(item => checkEmpty(item)); @@ -645,8 +650,8 @@ export class SinglePublicationComponent ); this.typeFields = this.typeFields.filter((item) => checkEmpty(item)); - // Jufo code 0 must be shown, so exception added - this.mediumFields = this.mediumFields.filter((item) => item.field !== 'jufoClassCode' ? checkEmpty(item) : true); + // Jufo code 0 must be shown, so exception added. Check empty function cannot be used, since in interprets 0 as empty. + this.mediumFields = this.mediumFields.filter((item) => item.field !== 'jufoClassCode' ? checkEmpty(item) : checkIfValueExists(item)); this.linksFields = this.linksFields.filter((item) => checkEmpty(item)); this.otherFields = this.otherFields.filter((item) => checkEmpty(item)); this.open_accessFields = this.open_accessFields.filter((item) =>