Skip to content

Commit

Permalink
Merge pull request #2025 from ORCID/fix/8692-qa-default-section-sort-…
Browse files Browse the repository at this point in the history
…order-for-professional-activities-needs-fixing-2

fix: Use distinction start date as end date when affiliation sorted b…
  • Loading branch information
leomendoza123 authored Jul 18, 2023
2 parents 69efee2 + 02178b1 commit 3e53801
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,20 @@ export class AffiliationsSortService {
ascending: boolean,
by: 'start' | 'end'
): number {
const dateStartA = this.yearMonthDaytoDate(a.defaultAffiliation.startDate)
const dateStartB = this.yearMonthDaytoDate(b.defaultAffiliation.startDate)
const dateFinishA = this.yearMonthDaytoDate(a.defaultAffiliation.endDate)
const dateFinishB = this.yearMonthDaytoDate(b.defaultAffiliation.endDate)
let dateStartA = this.yearMonthDaytoDate(a.defaultAffiliation.startDate)
let dateStartB = this.yearMonthDaytoDate(b.defaultAffiliation.startDate)
let dateFinishA = this.yearMonthDaytoDate(a.defaultAffiliation.endDate)
let dateFinishB = this.yearMonthDaytoDate(b.defaultAffiliation.endDate)

if (a.defaultAffiliation.affiliationType.value === AffiliationType.distinction && by === 'end') {
dateStartA = this.yearMonthDaytoDate(a.defaultAffiliation.endDate)
dateFinishA = this.yearMonthDaytoDate(a.defaultAffiliation.startDate)
}

if (b.defaultAffiliation.affiliationType.value === AffiliationType.distinction && by === 'end') {
dateStartB = this.yearMonthDaytoDate(b.defaultAffiliation.endDate)
dateFinishB = this.yearMonthDaytoDate(b.defaultAffiliation.startDate)
}

if (by === 'end') {
// If the end date is not the same use it to sort
Expand Down

0 comments on commit 3e53801

Please sign in to comment.