From 79fab2b105b9d5d6d396d0eb6cabb82b44a6844e Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 7 Aug 2023 12:01:51 +0000 Subject: [PATCH] Bug 34587: Fix keyword search in yearly filtered reports Signed-off-by: Jessica Zairo Signed-off-by: Michaela Sieber Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../ERM/UsageStatisticsReportsViewer.vue | 20 +++++++++++-------- .../prog/js/vue/fetch/erm-api-client.js | 20 +++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportsViewer.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportsViewer.vue index d553e96498..c6b1b0bba0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportsViewer.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportsViewer.vue @@ -267,7 +267,7 @@ export default { if (report_type === "monthly_with_totals") { column_set.push({ title: __("Period total"), - name: "usage_total", + data: "usage_total", searchable: true, orderable: true, }) @@ -279,8 +279,12 @@ export default { }, buildFilteredQuery(query, time_period_columns, year) { const queryObject = {} - const { metric_types, usage_data_providers, titles, report_type } = - query + const { + metric_types, + usage_data_providers, + keywords, + report_type, + } = query let data_type switch (report_type.substring(0, 1)) { case "P": @@ -306,12 +310,12 @@ export default { return month.value }) queryObject[`erm_usage_muses.month`] = months - // Add any title query - if (titles) { - const title_ids = titles.map(title => { - return title.title_id + // Add any keyword query + if (keywords) { + const object_ids = keywords.map(object => { + return object[`${data_type}_id`] }) - queryObject[`erm_usage_muses.title_id`] = title_ids + queryObject[`erm_usage_muses.${data_type}_id`] = object_ids } // Add any metric types query if (metric_types) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js index 355a91db87..72ff91fe2e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js @@ -343,6 +343,11 @@ export class ERMAPIClient extends HttpClient { get usage_platforms() { return { + getAll: query => + this.getAll({ + endpoint: "usage_platforms", + query: query, + }), count: (query = {}) => this.count({ endpoint: @@ -358,6 +363,11 @@ export class ERMAPIClient extends HttpClient { get usage_items() { return { + getAll: query => + this.getAll({ + endpoint: "usage_items", + query: query, + }), count: (query = {}) => this.count({ endpoint: @@ -373,6 +383,11 @@ export class ERMAPIClient extends HttpClient { get usage_databases() { return { + getAll: query => + this.getAll({ + endpoint: "usage_databases", + query: query, + }), count: (query = {}) => this.count({ endpoint: @@ -388,6 +403,11 @@ export class ERMAPIClient extends HttpClient { get usage_titles() { return { + getAll: query => + this.getAll({ + endpoint: "usage_titles", + query: query, + }), count: (query = {}) => this.count({ endpoint: -- 2.39.5