From e0bee8324daf193a646a3f8f39e9853e41399f92 Mon Sep 17 00:00:00 2001 From: wadeking98 Date: Tue, 14 Mar 2023 15:24:15 -0700 Subject: [PATCH] fixed the entity display bn on the entity details page Signed-off-by: wadeking98 --- src/components/entity/EntityResult.vue | 5 +++-- src/interfaces/api/v4/credential.interface.ts | 1 + src/utils/entity.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/entity/EntityResult.vue b/src/components/entity/EntityResult.vue index 536fc23..28078c7 100644 --- a/src/components/entity/EntityResult.vue +++ b/src/components/entity/EntityResult.vue @@ -814,7 +814,8 @@ export default class EntityResult extends Vue { get entityBusinessNumber(): string | undefined { return selectFirstAttrItem( { key: "type", value: "business_number" }, - this.entityCredentials?.map((cred) => { + // find the latest business number + this.entityCredentials?.filter(cred => cred.latest)?.map((cred) => { return { type: cred.type, text: cred.value, @@ -858,7 +859,7 @@ export default class EntityResult extends Vue { var fullCredentials: ICredentialDisplayType[] = []; this.selectedTopicFullCredentialSet.forEach((credSet) => { - //filter out all the raltionship credentials + //filter out all the relationship credentials fullCredentials.push( ...credSet.credentials .filter((cred) => !this.isRelationshipCred(cred)) diff --git a/src/interfaces/api/v4/credential.interface.ts b/src/interfaces/api/v4/credential.interface.ts index 762a229..331b15a 100644 --- a/src/interfaces/api/v4/credential.interface.ts +++ b/src/interfaces/api/v4/credential.interface.ts @@ -42,6 +42,7 @@ export interface ICredentialDisplayType { id: number; credential_type: string; rel_id?: string; + latest?: boolean; type: string; authority: string; authorityLink: string | URL; diff --git a/src/utils/entity.ts b/src/utils/entity.ts index 732f18f..23b8bcc 100644 --- a/src/utils/entity.ts +++ b/src/utils/entity.ts @@ -102,6 +102,7 @@ export function credOrRelationshipToDisplay( if (isCredential(item)) { const credItem = item as ICredential; display.id = credItem.id; + display.latest = credItem.latest; display.authority = credItem.credential_type.issuer.name; display.authorityLink = credItem.credential_type.issuer.url; display.type = credItem.names[0]?.type;