Skip to content

Commit

Permalink
Merge pull request #1884 from CSCfi/qa
Browse files Browse the repository at this point in the history
Qa
  • Loading branch information
konolak authored Dec 3, 2024
2 parents 91d74e7 + 174a77b commit 9280b67
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { SingleItemService } from '../../../services/single-item.service';
import { ActivatedRoute, Router, UrlTree, UrlSegmentGroup, PRIMARY_OUTLET, UrlSegment, RouterLink } from '@angular/router';
import { AppSettingsService } from '@shared/services/app-settings.service';
import { Subscription } from 'rxjs';
import { Subscription } from 'rxjs';
import { NgFor, NgIf } from '@angular/common';

@Component({
selector: 'app-related-links',
templateUrl: './related-links.component.html',
styleUrls: ['./related-links.component.scss'],
standalone: true,
imports: [
NgFor,
NgIf,
RouterLink,
],
@Component({
selector: 'app-related-links',
templateUrl: './related-links.component.html',
styleUrls: ['./related-links.component.scss'],
standalone: true,
imports: [
NgFor,
NgIf,
RouterLink,
],
})
export class RelatedLinksComponent implements OnInit, OnDestroy {
@Input() id: any;
Expand All @@ -46,11 +46,6 @@ export class RelatedLinksComponent implements OnInit, OnDestroy {
tab: 'infrastructures',
disabled: true,
},
{
label: $localize`:@@otherResearchActivities:Muut tutkimusaktiviteetit`,
tab: '',
disabled: true,
},
{
label: $localize`:@@organizations:Organisaatiot`,
tab: 'organizations',
Expand Down
10 changes: 6 additions & 4 deletions src/app/portal/models/person/person.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export class Person {
public keywords: string,
public collaboration: string[],
public uniqueDataSources: any,
public orcidLink?: string
public orcidLink?: string,
public updated?: string
) {}
}

Expand Down Expand Up @@ -147,11 +148,11 @@ export class PersonAdapter implements Adapter<Person> {
const fieldsOfScience = 'Placeholder';

const keywords = data.personal.keywords
.map((keyword) => keyword.value)
.map((keyword) => keyword.value).sort()
.join(', ');

const uniqueDataSources = data.uniqueDataSources
?.map((item) => this.utils.checkTranslation('name', item.organization))
?.map((item) => this.utils.checkTranslation('name', item.organization)).sort()
.join(', ');

return new Person(
Expand All @@ -172,7 +173,8 @@ export class PersonAdapter implements Adapter<Person> {
fieldsOfScience,
keywords,
collaboration,
uniqueDataSources
uniqueDataSources,
data.updated
);
}
}
2 changes: 2 additions & 0 deletions src/app/portal/services/filters/aggregation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ export class AggregationService {
},
};
break;

// Researchers
case 'persons':
payLoad.aggs.organization = {
nested: {
Expand Down
5 changes: 3 additions & 2 deletions src/app/portal/services/filters/filter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1062,14 +1062,15 @@ export class FilterService {
// If publications are searched without a search term then set sort as publicationYear
if (tab === 'publications') {
sortOrder.push({publicationYear: {order:'desc'}});
} else {
} else if (tab !== 'persons' && tab !== 'projects') {
sortOrder.push('_score');
}
} else {
// Search term or sort is used
if (tab === 'publications') {
sortOrder.push('_score');
sortOrder.push({publicationYear: {order:'desc'}});
} else {
} else if (tab !== 'persons' && tab !== 'projects') {
sortOrder.push('_score');
}
}
Expand Down
81 changes: 73 additions & 8 deletions src/app/portal/services/sort.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,81 @@ export class SortService {
break;
}
case 'persons': {
this.sort = [
{
'personal.names.lastName.keyword': {
order: this.sortDirection ? 'desc' : 'asc',
unmapped_type: 'long',
},
},
];
switch (this.sortColumn) {
case 'name': {
this.sort = [
{
'personal.names.lastName.keyword': {
order: this.sortDirection ? 'desc' : 'asc',
mode: "min",
unmapped_type : "long",
},
},
];
break;
}
case 'organization': {
const organizationSortString = 'activity.affiliations.organizationName' +
this.localeC +
'.keyword';
this.sort = [
{
[organizationSortString]: {
order: this.sortDirection ? 'desc' : 'asc',
mode: "min",
nested: this.generateNested('activity.affiliations', this.generateTermFilter(
'activity.affiliations.itemMeta.primaryValue',
true
)),
unmapped_type : "long",
},
},
];
break;
}
case 'positionName': {
const organizationSortString = 'activity.affiliations.positionName' +
this.localeC +
'.keyword';
this.sort = [
{
[organizationSortString]: {
order: this.sortDirection ? 'desc' : 'asc',
mode: "min",
nested: this.generateNested('activity.affiliations'),
unmapped_type : "long",
},
},
];
break;
}
case 'keywords': {
this.sort = [
{
'personal.keywords.value.keyword': {
order: this.sortDirection ? 'desc' : 'asc',
mode: "min",
unmapped_type : "long",
},
},
];
break;
}
default: {
this.sort = [
{
'updated': {
order: 'desc',
unmapped_type : "long",
},
}
];
break;
}
}
break;
}

case 'fundings': {
this.yearField = 'fundingStartYear';
switch (this.sortColumn) {
Expand Down

0 comments on commit 9280b67

Please sign in to comment.