From 944512d7fae2fb8f08e54d35f11f811cdb990fdf Mon Sep 17 00:00:00 2001 From: Pat Date: Wed, 18 Sep 2024 14:40:19 -0600 Subject: [PATCH 1/2] People List Page: filters out any unselected groupings --- js/ucb-people-list.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/ucb-people-list.js b/js/ucb-people-list.js index 1cd96737..3a2fe596 100644 --- a/js/ucb-people-list.js +++ b/js/ucb-people-list.js @@ -95,6 +95,7 @@ let config = {}; try { config = this._config = JSON.parse(this.getAttribute('config')) || config; + console.log(config) } catch (e) { } this._baseURI = this.getAttribute('base-uri'); const @@ -229,16 +230,19 @@ if (groupingData && groupingData.length) { hasGroupingTaxonomy = true; } - ((person['relationships']['field_ucb_person_' + groupBy] || {})['data'] || []).forEach( - termData => { - const termId = termData['meta']['drupal_internal__target_id']; + + ((person['relationships']['field_ucb_person_' + groupBy] || {})['data'] || []).forEach(termData => { + const termId = termData['meta']['drupal_internal__target_id']; + // If there are filters applied to the current groupBy field (e.g., job_type), apply them so unwanted groups don't show up + if (!this._filters[groupBy] || this._filters[groupBy].includes.length === 0 || this._filters[groupBy].includes.map(Number).includes(termId)) { let termPeople = groupedPeople.get(termId); if (!termPeople) { termPeople = []; groupedPeople.set(termId, termPeople); } termPeople.push(person); - }); + } + }); }); if (!hasGroupingTaxonomy) { this.toggleMessageDisplay(this._messageElement, 'block', 'ucb-list-msg', `No results found for the '${groupBy}' grouping.`); From b9b7b05fad0c79e51d217a680fd089cb7db381b9 Mon Sep 17 00:00:00 2001 From: Pat Date: Thu, 19 Sep 2024 08:52:59 -0600 Subject: [PATCH 2/2] Remove logging --- js/ucb-people-list.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/ucb-people-list.js b/js/ucb-people-list.js index 3a2fe596..b7b221a7 100644 --- a/js/ucb-people-list.js +++ b/js/ucb-people-list.js @@ -95,7 +95,6 @@ let config = {}; try { config = this._config = JSON.parse(this.getAttribute('config')) || config; - console.log(config) } catch (e) { } this._baseURI = this.getAttribute('base-uri'); const