From fbc17d98705c8db1996e192576f99fdfeca520ae Mon Sep 17 00:00:00 2001 From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:26:25 -0500 Subject: [PATCH] Allow users to sort by view and download count (#2400) --- app/institutions/dashboard/preprints/controller.ts | 4 ++++ app/institutions/dashboard/projects/controller.ts | 2 ++ app/institutions/dashboard/registrations/controller.ts | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/institutions/dashboard/preprints/controller.ts b/app/institutions/dashboard/preprints/controller.ts index 1d6d101c48..0158ad7e54 100644 --- a/app/institutions/dashboard/preprints/controller.ts +++ b/app/institutions/dashboard/preprints/controller.ts @@ -50,6 +50,8 @@ 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'), @@ -57,6 +59,8 @@ export default class InstitutionDashboardPreprints extends Controller { const metrics = searchResult.usageMetrics; return metrics ? metrics.downloadCount : this.missingItemPlaceholder; }, + sortKey: 'usage.downloadCount', + sortParam: 'integer-value', }, ]; diff --git a/app/institutions/dashboard/projects/controller.ts b/app/institutions/dashboard/projects/controller.ts index d412ece4fb..6e80d937ef 100644 --- a/app/institutions/dashboard/projects/controller.ts +++ b/app/institutions/dashboard/projects/controller.ts @@ -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'), diff --git a/app/institutions/dashboard/registrations/controller.ts b/app/institutions/dashboard/registrations/controller.ts index e9ba285377..7a997a0af5 100644 --- a/app/institutions/dashboard/registrations/controller.ts +++ b/app/institutions/dashboard/registrations/controller.ts @@ -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'),