diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index 5d91c5f7..bd63e6c1 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -72,12 +72,20 @@ export class PersonListComponent { return { ...response, - results: [...response.results].sort( - (a, b) => this.getSortRank(a) - this.getSortRank(b) - ), + results: [...response.results].sort((personA, personB) => { + const rankDiff = this.getSortRank(personA) - this.getSortRank(personB); + if (rankDiff !== 0) { + return rankDiff; + } + return this.getWorksCount(personB) - this.getWorksCount(personA); + }), }; } + getWorksCount(person: Author): number { + return person.works_count ?? 0; + } + getSortRank(person: Author): number { if (this.hasInstitution(person) && this.hasOrcid(person)) return 0; if (this.hasInstitution(person)) return 1;