Skip to content

Commit

Permalink
Merge pull request #2453 from HHS/TTAHUB-3598/public-group-filters
Browse files Browse the repository at this point in the history
[TTAHUB-3598] QA Dashboard groups filter not working for public groups
  • Loading branch information
GarrettEHill authored Nov 4, 2024
2 parents a6ae09a + 0477213 commit be5e8c3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 31 deletions.
3 changes: 1 addition & 2 deletions frontend/src/fetchers/ssdi.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import join from 'url-join';
import { get } from './index';
import { filtersToQueryString } from '../utils';
import { QA_DASHBOARD_FILTER_CONFIG } from '../pages/QADashboard/constants';

const ssdiUrl = join('/', 'api', 'ssdi');

Expand Down Expand Up @@ -43,7 +42,7 @@ const allowedTopicsForQuery = {
'domainInstructionalSupport',
'createDate',
],
'qa-dashboard': [...QA_DASHBOARD_FILTER_CONFIG.map((filter) => filter.id),
'qa-dashboard': [
'endDate',
'startDate',
'activityReportGoalResponse',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/QADashboard/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const combinedDates = `${encodeURIComponent(todayMinus12Months)}-${encodeURIComp
const baseSsdiApi = '/api/ssdi/api/dashboards/qa/';
const noTtaApi = `${baseSsdiApi}no-tta.sql?region.in[]=1&region.in[]=2&startDate.win=${combinedDates}&dataSetSelection[]=no_tta_widget`;
const feiApi = `${baseSsdiApi}fei.sql?region.in[]=1&region.in[]=2&createDate.win=${combinedDates}&dataSetSelection[]=with_fei_widget&dataSetSelection[]=with_fei_graph`;
const dashboardApi = `${baseSsdiApi}dashboard.sql?region.in[]=1&region.in[]=2&startDate.win=${combinedDates}&createDate.win=${combinedDates}&dataSetSelection[]=delivery_method_graph&dataSetSelection[]=role_graph&dataSetSelection[]=activity_widget`;
const dashboardApi = `${baseSsdiApi}dashboard.sql?region.in[]=1&region.in[]=2&startDate.win=${combinedDates}&dataSetSelection[]=delivery_method_graph&dataSetSelection[]=role_graph&dataSetSelection[]=activity_widget`;
const classApi = `${baseSsdiApi}class.sql?region.in[]=1&region.in[]=2&createDate.win=${combinedDates}&dataSetSelection[]=with_class_widget`;
const RECIPIENTS_WITH_NO_TTA_DATA = [
{
Expand Down
53 changes: 28 additions & 25 deletions frontend/src/pages/QADashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,37 @@ export default function QADashboard() {
setIsLoading(true);
// Filters passed also contains region.
try {
// Recipient with no tta data.
const recipientsWithNoTtaData = await getSelfServiceData(
'recipients-with-no-tta',
filters,
['no_tta_widget'],
);
const [
recipientsWithNoTtaData,
feiData,
classData,
dashboardData,
] = await Promise.all([
getSelfServiceData(
'recipients-with-no-tta',
filters,
['no_tta_widget'],
),
getSelfServiceData(
'recipients-with-ohs-standard-fei-goal',
filters,
['with_fei_widget', 'with_fei_graph'],
),
getSelfServiceData(
'recipients-with-class-scores-and-goals',
filters,
['with_class_widget'],
),
getSelfServiceData(
'qa-dashboard',
filters,
['delivery_method_graph', 'role_graph', 'activity_widget'],
),
]);

const noTTAContainsFiltersThatAreNotAllowed = containsFiltersThatAreNotApplicable('recipients-with-no-tta', filters);
const noTTAData = recipientsWithNoTtaData.find((item) => item.data_set === 'no_tta_widget');

// FEI data.
const feiData = await getSelfServiceData(
'recipients-with-ohs-standard-fei-goal',
filters,
['with_fei_widget', 'with_fei_graph'],
);
const feiContainsFiltersThatAreNotAllowed = containsFiltersThatAreNotApplicable('recipients-with-ohs-standard-fei-goal', filters);
const feiOverviewData = feiData.find((item) => item.data_set === 'with_fei_widget');
const feiGraphData = feiData.find((item) => item.data_set === 'with_fei_graph');
Expand All @@ -114,12 +130,6 @@ export default function QADashboard() {
showDashboardFiltersNotApplicable: feiContainsFiltersThatAreNotAllowed,
};

// CLASS data.
const classData = await getSelfServiceData(
'recipients-with-class-scores-and-goals',
filters,
['with_class_widget'],
);
const classContainsFiltersThatAreNotAllowed = containsFiltersThatAreNotApplicable('recipients-with-class-scores-and-goals', filters);
const classOverviewData = classData.find((item) => item.data_set === 'with_class_widget');

Expand All @@ -146,13 +156,6 @@ export default function QADashboard() {
},
};

// Dashboard data.
const dashboardData = await getSelfServiceData(
'qa-dashboard',
filters,
['delivery_method_graph', 'role_graph', 'activity_widget'],
);

const showDashboardFiltersNotApplicable = containsFiltersThatAreNotApplicable('qa-dashboard', filters);

const deliveryMethodData = dashboardData.find((item) => item.data_set === 'delivery_method_graph');
Expand Down
2 changes: 1 addition & 1 deletion src/queries/api/dashboards/qa/class.sql
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ BEGIN
)
WHERE 1 = 1
-- Continued Filter for group if ssdi.group is defined from left joined table above
AND (group_filter IS NULL OR (g.id IS NOT NULL AND gc.id IS NOT NULL))
AND (group_filter IS NULL OR (g.id IS NOT NULL AND (gc.id IS NOT NULL OR g."sharedWith" = 'Everyone')))
ORDER BY 1
),
applied_filtered_out_grants AS (
Expand Down
2 changes: 1 addition & 1 deletion src/queries/api/dashboards/qa/dashboard.sql
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ BEGIN
)
WHERE 1 = 1
-- Continued Filter for group if ssdi.group is defined from left joined table above
AND (group_filter IS NULL OR (g.id IS NOT NULL AND gc.id IS NOT NULL))
AND (group_filter IS NULL OR (g.id IS NOT NULL AND (gc.id IS NOT NULL OR g."sharedWith" = 'Everyone')))
ORDER BY 1
),
applied_filtered_out_grants AS (
Expand Down
2 changes: 1 addition & 1 deletion src/queries/api/dashboards/qa/fei.sql
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ BEGIN
)
WHERE 1 = 1
-- Continued Filter for group if ssdi.group is defined from left joined table above
AND (group_filter IS NULL OR (g.id IS NOT NULL AND gc.id IS NOT NULL))
AND (group_filter IS NULL OR (g.id IS NOT NULL AND (gc.id IS NOT NULL OR g."sharedWith" = 'Everyone')))
ORDER BY 1
),
applied_filtered_out_grants AS (
Expand Down

0 comments on commit be5e8c3

Please sign in to comment.