Skip to content

Commit

Permalink
Allow users to sort by view and download count (#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda authored Nov 18, 2024
1 parent fe98821 commit fbc17d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/institutions/dashboard/preprints/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ export default class InstitutionDashboardPreprints extends Controller {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
sortKey: 'usage.viewCount',
sortParam: 'integer-value',
},
{ // Download count
name: this.intl.t('institutions.dashboard.object-list.table-headers.download_count'),
getValue: searchResult => {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.downloadCount : this.missingItemPlaceholder;
},
sortKey: 'usage.downloadCount',
sortParam: 'integer-value',
},
];

Expand Down
2 changes: 2 additions & 0 deletions app/institutions/dashboard/projects/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export default class InstitutionDashboardProjects extends Controller {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
sortKey: 'usage.viewCount',
sortParam: 'integer-value',
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
Expand Down
2 changes: 2 additions & 0 deletions app/institutions/dashboard/registrations/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default class InstitutionDashboardRegistrations extends Controller {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
sortKey: 'usage.viewCount',
sortParam: 'integer-value',
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
Expand Down

0 comments on commit fbc17d9

Please sign in to comment.