Bug 34587: Fix keyword search in yearly filtered reports

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Matt Blenkinsop 2023-08-07 12:01:51 +00:00 committed by Tomas Cohen Arazi
parent e935423b78
commit 79fab2b105
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 32 additions and 8 deletions

View file

@ -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) {

View file

@ -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: