From 44775512cde3ce10f6d5d28db03898a088203c37 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Tue, 16 Oct 2018 12:55:08 -0300 Subject: [PATCH] Delete fectch_only to array item in facets endpoint when it's values are null. --- src/classes/filter-types/filter-types-mixin.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/classes/filter-types/filter-types-mixin.js b/src/classes/filter-types/filter-types-mixin.js index 54c3677cd..4e9ff0b13 100644 --- a/src/classes/filter-types/filter-types-mixin.js +++ b/src/classes/filter-types/filter-types-mixin.js @@ -19,7 +19,12 @@ export const filter_type_mixin = { }, methods: { getValuesPlainText(metadatumId, search, isRepositoryLevel, valuesToIgnore, offset, number, isInCheckboxModal, getSelected = '0') { - let query_items = { 'current_query': this.query }; + let currentQuery = JSON.parse(JSON.stringify(this.query)); + for (let key of Object.keys(currentQuery.fetch_only)) { + if (currentQuery.fetch_only[key] == null) + delete currentQuery.fetch_only[key]; + } + let query_items = { 'current_query': currentQuery }; let url = `/collection/${this.collection}/facets/${metadatumId}?getSelected=${getSelected}&`; @@ -103,7 +108,12 @@ export const filter_type_mixin = { }); }, getValuesRelationship(collectionTarget, search, valuesToIgnore, offset, number, isInCheckboxModal, getSelected = '0') { - let query_items = { 'current_query': this.query }; + let currentQuery = JSON.parse(JSON.stringify(this.query)); + for (let key of Object.keys(currentQuery.fetch_only)) { + if (currentQuery.fetch_only[key] == null) + delete currentQuery.fetch_only[key]; + } + let query_items = { 'current_query': currentQuery }; let url = '/collection/' + this.filter.collection_id + '/facets/' + this.filter.metadatum.metadatum_id + `?getSelected=${getSelected}&`; if(offset != undefined && number != undefined){