From b40ed5ab3c9c291ea341ddef13608af387970e00 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 20 Sep 2024 15:31:01 -0400 Subject: [PATCH 1/2] Fixed a bug where the filter params where not being properly updated in the get params if there was more than one filter present due to overwritten filter params during the QueueTable deep linking. --- client/app/queue/QueueTable.jsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/client/app/queue/QueueTable.jsx b/client/app/queue/QueueTable.jsx index 42d4098bf55..41edb0c0e89 100644 --- a/client/app/queue/QueueTable.jsx +++ b/client/app/queue/QueueTable.jsx @@ -579,14 +579,23 @@ export default class QueueTable extends React.PureComponent { // Remove paramsToClear from currentParams if they are not in tableParams paramsToClear.forEach((param) => { - if (!tableParams.has(param)) { - currentParams.delete(param); - } + currentParams.delete(param); }); // Merge tableParams and tabParams into currentParams, overwriting any duplicate keys for (const [key, value] of [...tabParams.entries(), ...tableParams.entries()]) { - currentParams.set(key, value); + if (key.includes('[]')) { + // Get all current values for the key + const existingValues = currentParams.getAll(key); + + // If the new value doesn't already exist, append it + if (!existingValues.includes(value)) { + currentParams.append(key, value); + } + } else { + // Set for all other keys (overrides existing values) + currentParams.set(key, value); + } } return `${base}?${currentParams.toString()}`; From 096145acd2b7a05cc96fec5337c9ec930ee4360e Mon Sep 17 00:00:00 2001 From: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:18:56 -0400 Subject: [PATCH 2/2] Tylerb/appeals 56610: Updates to 56610 (#23344) * Initial commit that alters the business line logic to accept a date filter for the tasks completed at column and logic to support and filter by it via the database query. * Added new tests for the tasksClosedAt filter to the business line spec. Adjusted the between lambda filter to work for either ordering of the start date or end date as the first chronological date in the query. Optimized the business line spec by swapping to before all loops and instance variables to shorten the time it takes to run the test. * Rewrote a bit more of the business line spec to speed it up via one time test data setup rather than for each test. * Updated the vha business line spec file. Fixed a code climate warning. * Removed some commented out code and changed the database cleaner to Task.delete all to be a bit more specific on cleanup before the change history tests. * Removed QueueTable code that was unrelated to the DatePicker that was causing errors. * Updated the wording in the filter summary for the closedAt filter to say Date Compeleted instead of closedAt. * Fixed a bug where the filter preservation was not working with the way the date filter params were added to the get params. Altered the Completed tasks tab description based on the Date Completed filter. Started adding a feature test for the completed date filtering. * Updated the formatting of the date in the completed tasks tab description to match mm/dd/yyyy format. Finished up the feature spec test for the completed date filtering. * Updated the expected values from the DatePicker to match what was in the feature branch. Updated the completed tasks tab description to once again be last 7 days for any business line that is not the VHA. Fixed a code climate issue with the new regex used for the filter preservation hook. Updated the new vha completed by date column to match the old column value so sorting and filtering will work correctly. * Updated the aria label in the new column. * Fixed failing tests related to the completed date column, completed tasks description, and the clear filters change from the DatePicker. * Changed single quotes to double quotes in ruby. * Fixed a few more test failures. * Altered the date picker validation code to disable the button if no date is selected for on, before, or after. * Updated the completed tasks tab description filtered by completed text to be less verbose. Change .nil? to .blank? in the closed_at filter parsing. Updated the test to reflect the new wording. * Updated the Completed Cases text to contain no colon for the vha decision review queue. Fixed a bug in the date picker where the View All was not resetting the filter correctly. * Fixed a few jest tests. * Fixed a bug that could occur if you are trying to filter by a column that does not exist in a different queue. * Updated feature test with the new vha all completed cases description text without a colon. * Fixed a text issue when swapping between business lines with the same user that has a filter from the vha business line. --------- Co-authored-by: Brandon Lee Dorner <51007432+brandondorner@users.noreply.github.com> --- client/COPY.json | 2 +- client/app/components/DatePicker.jsx | 22 ++++++++++++++----- client/app/nonComp/components/NonCompTabs.jsx | 8 +++---- client/app/queue/QueueTable.jsx | 2 +- client/test/app/components/DatePicker.test.js | 6 ++--- client/test/app/nonComp/NonCompTabs.test.js | 2 +- spec/feature/non_comp/reviews_spec.rb | 4 ++-- 7 files changed, 29 insertions(+), 17 deletions(-) diff --git a/client/COPY.json b/client/COPY.json index c9fad28a95c..02c9fd85d1f 100644 --- a/client/COPY.json +++ b/client/COPY.json @@ -328,7 +328,7 @@ "ORGANIZATIONAL_QUEUE_PAGE_ASSIGNED_TAB_TITLE": "Assigned (%d)", "ORGANIZATIONAL_QUEUE_PAGE_IN_PROGRESS_TAB_TITLE": "In Progress (%d)", "ORGANIZATIONAL_QUEUE_ON_HOLD_TAB_TITLE": "On Hold (%d)", - "VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION": "Cases completed:", + "VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION": "Cases completed", "VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION_WITH_FILTER": "Cases completed (%s)", "EDUCATION_RPO_QUEUE_PAGE_COMPLETED_TASKS_DESCRIPTION": "Cases completed in the last 7 days:", "VHA_ORGANIZATIONAL_QUEUE_PAGE_READY_FOR_REVIEW_TAB_TITLE": "Ready for Review", diff --git a/client/app/components/DatePicker.jsx b/client/app/components/DatePicker.jsx index 0a7817d2c84..4133b23c128 100644 --- a/client/app/components/DatePicker.jsx +++ b/client/app/components/DatePicker.jsx @@ -161,6 +161,13 @@ class DatePicker extends React.PureComponent { apply() { const { onChange } = this.props; + if (this.state.mode === 'all') { + this.clearFilter(); + this.hideDropdown(); + + return true; + } + if (onChange) { onChange(`${this.state.mode },${ this.state.startDate },${ this.state.endDate}`); } @@ -225,6 +232,8 @@ class DatePicker extends React.PureComponent { } } else if (this.state.mode !== '') { disabled = this.state.startDate === ''; + } else if (this.state.mode === 'all') { + disabled = false; } return disabled; @@ -243,19 +252,22 @@ class DatePicker extends React.PureComponent { } updateMode = (mode) => { + const format = 'YYYY-MM-DD'; + this.setState({ mode }); if (mode !== 'between') { this.setState({ endDate: '' }); } if (mode === 'last7') { - this.setState({ startDate: moment().subtract(7, 'days') }); + this.setState({ startDate: moment().subtract(7, 'days'). + format(format) }); } else if (mode === 'last30') { - this.setState({ startDate: moment().subtract(30, 'days') }); + this.setState({ startDate: moment().subtract(30, 'days'). + format(format) }); } else if (mode === 'last365') { - this.setState({ startDate: moment().subtract(365, 'days') }); - } else if (mode === 'all') { - this.setState({ startDate: moment().subtract(300, 'years') }); + this.setState({ startDate: moment().subtract(365, 'days'). + format(format) }); } } diff --git a/client/app/nonComp/components/NonCompTabs.jsx b/client/app/nonComp/components/NonCompTabs.jsx index 46109b3097e..2701bc75a2b 100644 --- a/client/app/nonComp/components/NonCompTabs.jsx +++ b/client/app/nonComp/components/NonCompTabs.jsx @@ -52,7 +52,9 @@ const NonCompTabsUnconnected = (props) => { const buildCompletedTabDescriptionFromFilter = (filters) => { const completedDateFilter = filters.find((value) => value.includes('col=completedDateColumn')); - if (completedDateFilter) { + if (!isVhaBusinessLine) { + return COPY.QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION; + } else if (completedDateFilter) { const match = completedDateFilter.match(/val=([^&]*)/); if (match) { @@ -78,11 +80,9 @@ const NonCompTabsUnconnected = (props) => { completedDateFilterModeHandlers[mode]); } - } else if (!isVhaBusinessLine) { - return COPY.QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION; } - return COPY.QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION; + return COPY.VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION; }; diff --git a/client/app/queue/QueueTable.jsx b/client/app/queue/QueueTable.jsx index 90f7aa53333..71a7f8d3a55 100644 --- a/client/app/queue/QueueTable.jsx +++ b/client/app/queue/QueueTable.jsx @@ -423,7 +423,7 @@ export default class QueueTable extends React.PureComponent { }); } - return filters; + return _.omit(filters, 'undefined'); }; defaultRowClassNames = () => ''; diff --git a/client/test/app/components/DatePicker.test.js b/client/test/app/components/DatePicker.test.js index eada26082f6..4a6996555e6 100644 --- a/client/test/app/components/DatePicker.test.js +++ b/client/test/app/components/DatePicker.test.js @@ -157,7 +157,7 @@ describe('DatePicker', () => { clickSubmissionButton('Apply Filter'); - expect(handleChange).toHaveBeenCalledWith('last7,Wed Jan 10 2024 02:00:00 GMT-0500,'); + expect(handleChange).toHaveBeenCalledWith('last7,2024-01-10,'); }); it('quick select options can select last 30 days', async () => { @@ -173,7 +173,7 @@ describe('DatePicker', () => { clickSubmissionButton('Apply Filter'); - expect(handleChange).toHaveBeenCalledWith('last30,Mon Dec 18 2023 02:00:00 GMT-0500,'); + expect(handleChange).toHaveBeenCalledWith('last30,2023-12-18,'); }); it('quick select options can select last 365 days', async () => { @@ -189,7 +189,7 @@ describe('DatePicker', () => { clickSubmissionButton('Apply Filter'); - expect(handleChange).toHaveBeenCalledWith('last365,Tue Jan 17 2023 02:00:00 GMT-0500,'); + expect(handleChange).toHaveBeenCalledWith('last365,2023-01-17,'); }); it('disables Apply Filter button if between is selected and the start date is after the end date', () => { diff --git a/client/test/app/nonComp/NonCompTabs.test.js b/client/test/app/nonComp/NonCompTabs.test.js index a85b9590731..d08de1d322f 100644 --- a/client/test/app/nonComp/NonCompTabs.test.js +++ b/client/test/app/nonComp/NonCompTabs.test.js @@ -178,7 +178,7 @@ describe('NonCompTabsVha', () => { await waitFor(() => { // expect(screen.getByText('Cases completed (last 7 days):')).toBeInTheDocument(); - expect(screen.getByText('Cases completed:')).toBeInTheDocument(); + expect(screen.getByText('Cases completed')).toBeInTheDocument(); }); // Check for the correct completed tasks header values diff --git a/spec/feature/non_comp/reviews_spec.rb b/spec/feature/non_comp/reviews_spec.rb index b048313b660..c330b9f69c6 100644 --- a/spec/feature/non_comp/reviews_spec.rb +++ b/spec/feature/non_comp/reviews_spec.rb @@ -585,7 +585,7 @@ def current_table_rows # Verify the filter counts for the completed tab click_on "Completed Tasks" - expect(page).to have_content(COPY::QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION) + expect(page).to have_content(COPY::VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION) # Turn this back on after last 7 days prefilter is added # expect(page).to have_content(COPY::QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION) find("[aria-label='Filter by issue type']").click @@ -1003,7 +1003,7 @@ def current_table_rows # expect(page).to have_content("Viewing 1-2 of 2 total") # Remove these 3 once Last 7 days pre filter is added back - expect(page).to have_content("Cases completed:") + expect(page).to have_content(COPY::VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION) expect(page).to_not have_content("Date Completed (1)") expect(page).to have_content("Viewing 1-3 of 3 total")