diff --git a/src/app/common/components/issuer/oeb-issuer-detail.component.ts b/src/app/common/components/issuer/oeb-issuer-detail.component.ts index 2363817b3..13af85fb7 100644 --- a/src/app/common/components/issuer/oeb-issuer-detail.component.ts +++ b/src/app/common/components/issuer/oeb-issuer-detail.component.ts @@ -803,6 +803,11 @@ export class BadgeResult { public badge: BadgeClass | PublicApiBadgeClass, public issuerName: string, public requestCount: number, - public awardedCount: number, + private _awardedCount?: number, ) {} + + get awardedCount(): number { + if (this._awardedCount !== undefined) return this._awardedCount; + return this.badge instanceof BadgeClass ? this.badge.recipientCount : 0; + } } diff --git a/src/app/issuer/components/issuer-detail/issuer-detail.component.ts b/src/app/issuer/components/issuer-detail/issuer-detail.component.ts index 418ad5471..b0480da6d 100644 --- a/src/app/issuer/components/issuer-detail/issuer-detail.component.ts +++ b/src/app/issuer/components/issuer-detail/issuer-detail.component.ts @@ -18,7 +18,7 @@ import { LinkEntry, BgBreadcrumbsComponent } from '../../../common/components/bg import { MenuItem } from '../../../common/components/badge-detail/badge-detail.component.types'; import { LearningPathApiService } from '../../../common/services/learningpath-api.service'; import { ApiLearningPath } from '../../../common/model/learningpath-api.model'; -import { first, firstValueFrom } from 'rxjs'; +import { firstValueFrom } from 'rxjs'; import { TranslateService } from '@ngx-translate/core'; import { FormMessageComponent } from '../../../common/components/form-message.component'; import { BgAwaitPromises } from '../../../common/directives/bg-await-promises'; @@ -109,7 +109,9 @@ export class IssuerDetailComponent extends BaseAuthenticatedRoutableComponent im { title: this.issuer.name, routerLink: ['/issuer/issuers/' + this.issuer.slug] }, ]; - this.badgesLoaded = firstValueFrom(this.badgeClassService.badgesByIssuerUrl$) + this.badgesLoaded = this.badgeClassService.badgesList + .updateList() + .then(() => firstValueFrom(this.badgeClassService.badgesByIssuerUrl$)) .then((badgesByIssuer) => { const cmp = (a, b) => (a === b ? 0 : a < b ? -1 : 1); this.badges = (badgesByIssuer[this.issuer.issuerUrl] || []).sort((a, b) =>