Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prod] Cache IST/NC on completed training reports, frontend for goal name filter #2061

Merged
merged 40 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
404054c
Initial commit
thewatermethod Feb 21, 2024
a88cefb
Add hook
thewatermethod Feb 21, 2024
59623d0
Fix FE test
thewatermethod Feb 21, 2024
9864997
Add tests for hook
thewatermethod Feb 21, 2024
729a47a
Update test for tool
thewatermethod Feb 21, 2024
ba02249
Revert borked migrations
thewatermethod Feb 21, 2024
5379832
Add down to migration
thewatermethod Feb 21, 2024
f6dba65
Update backend test collisions
thewatermethod Feb 22, 2024
bd1ed4d
add additional frontend tests
thewatermethod Feb 26, 2024
b06d77d
fixes from UI testing
thewatermethod Feb 26, 2024
bd821db
Do not fire hooks in test
thewatermethod Feb 26, 2024
a6b697a
Fix test
thewatermethod Feb 26, 2024
b872415
Updates to bulkcreates
thewatermethod Feb 26, 2024
0636fd4
Revisit constraint
thewatermethod Feb 26, 2024
1b9c8f7
Update hook given current constraints and add test
thewatermethod Feb 29, 2024
518d1d1
Merge remote-tracking branch origin/main into mb/TTAHUB-2315/cache-IST
thewatermethod Feb 29, 2024
364530e
Fix other test
thewatermethod Mar 1, 2024
63c8dcd
Merge remote-tracking branch origin/main into mb/TTAHUB-2315/cache-IST
thewatermethod Mar 11, 2024
8b2e176
Rerun model encoding
thewatermethod Mar 11, 2024
4e9c554
Rename migration
thewatermethod Mar 11, 2024
038e0d6
Merge remote-tracking branch origin/main into mb/TTAHUB-2315/cache-IST
thewatermethod Mar 18, 2024
f6428af
Rename migration
thewatermethod Mar 18, 2024
22aa24f
Switch from "bulkCreate" to "findOrCreate"
thewatermethod Mar 18, 2024
1f59304
frontend work for goal name filter
thewatermethod Mar 20, 2024
6c3aba0
Deploy to dev
thewatermethod Mar 20, 2024
5af3366
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2501/front-…
thewatermethod Mar 22, 2024
fd68dc4
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2315/cache-IST
thewatermethod Mar 25, 2024
aefb812
Update encoding
thewatermethod Mar 25, 2024
8b4a32d
Update to add commas
thewatermethod Mar 25, 2024
f053fb5
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2501/front-…
thewatermethod Mar 25, 2024
fe5660b
Fix test for added commas
thewatermethod Mar 25, 2024
015a430
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2501/front-…
thewatermethod Mar 26, 2024
20a9448
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2315/cache-IST
thewatermethod Mar 26, 2024
30b48b0
rename migration
thewatermethod Mar 26, 2024
2660442
Update express
thewatermethod Mar 26, 2024
f48f083
Merge branch update-express-3-26-24 into mb/TTAHUB-2315/cache-IST
thewatermethod Mar 26, 2024
961f351
Merge branch 'update-express-3-26-24' into mb/TTAHUB-2501/front-end-g…
thewatermethod Mar 26, 2024
e6bea23
Merge pull request #2060 from HHS/update-express-3-26-24
thewatermethod Mar 26, 2024
84cce5a
Merge pull request #1988 from HHS/mb/TTAHUB-2315/cache-IST
thewatermethod Mar 26, 2024
06a716f
Merge pull request #2045 from HHS/mb/TTAHUB-2501/front-end-goal-name-…
thewatermethod Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
default: "jp/2128/display-goal-creator-name"
default: "mb/TTAHUB-2501/front-end-goal-name-filter"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "kw-fix-fkey-error"
Expand Down
2 changes: 1 addition & 1 deletion docs/logical_data_model.encoded

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions docs/logical_data_model.puml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ class EventReportPilotGoals{
* updatedAt : timestamp with time zone
}

class EventReportPilotNationalCenterUsers{
* id : integer : <generated>
* eventReportPilotId : integer : REFERENCES "EventReportPilots".id
* nationalCenterId : integer : REFERENCES "NationalCenters".id
* userId : integer : REFERENCES "Users".id
* createdAt : timestamp with time zone : now()
* nationalCenterName : varchar(255)
* updatedAt : timestamp with time zone : now()
* userName : varchar(255)
}

class EventReportPilots{
* id : integer : <generated>
* collaboratorIds : integer[]
Expand Down Expand Up @@ -1356,6 +1367,20 @@ class ZALEventReportPilotGoals{
session_sig : text
}

class ZALEventReportPilotNationalCenterUsers{
* id : bigint : <generated>
* data_id : bigint
* dml_as : bigint
* dml_by : bigint
* dml_timestamp : timestamp with time zone
* dml_txid : uuid
* dml_type : enum
descriptor_id : integer
new_row_data : jsonb
old_row_data : jsonb
session_sig : text
}

class ZALEventReportPilots{
* id : bigint : <generated>
* data_id : bigint
Expand Down Expand Up @@ -2325,6 +2350,7 @@ Courses "1" --[#black,dashed,thickness=2]--{ "n" ActivityReportObjectiveCourses
Courses "1" --[#black,dashed,thickness=2]--{ "n" Courses : mapsFromCourse, mapsToCourse
Courses "1" --[#black,dashed,thickness=2]--{ "n" ObjectiveCourses : objectiveCourses, course
EventReportPilots "1" --[#black,dashed,thickness=2]--{ "n" EventReportPilotGoals : event, eventReportPilotGoals
EventReportPilots "1" --[#black,dashed,thickness=2]--{ "n" EventReportPilotNationalCenterUsers : event, eventReportPilotNationalCenterUsers
EventReportPilots "1" --[#black,dashed,thickness=2]--{ "n" SessionReportPilots : sessionReports, event
Files "1" --[#black,dashed,thickness=2]--{ "n" ActivityReportFiles : file, reportFiles
Files "1" --[#black,dashed,thickness=2]--{ "n" ActivityReportObjectiveFiles : file, reportObjectiveFiles
Expand Down Expand Up @@ -2370,6 +2396,7 @@ MonitoringReviewLinks "1" --[#black,dashed,thickness=2]--{ "n" MonitoringReview
MonitoringReviewLinks "1" --[#black,dashed,thickness=2]--{ "n" MonitoringReviews : monitoringReviews, monitoringReviewLink
MonitoringReviewStatusLinks "1" --[#black,dashed,thickness=2]--{ "n" MonitoringReviewStatuses : monitoringReviewStatuses, statusLink
MonitoringReviewStatusLinks "1" --[#black,dashed,thickness=2]--{ "n" MonitoringReviews : monitoringReviews, statusLink
NationalCenters "1" --[#black,dashed,thickness=2]--{ "n" EventReportPilotNationalCenterUsers : nationalCenter, eventReportPilotNationalCenterUsers
NationalCenters "1" --[#black,dashed,thickness=2]--{ "n" NationalCenterUsers : nationalCenter, nationalCenterUsers
NationalCenters "1" --[#black,dashed,thickness=2]--{ "n" NationalCenters : mapsToNationalCenter, mapsFromNationalCenters
NextSteps "1" --[#black,dashed,thickness=2]--{ "n" NextStepResources : nextStep, nextStepResources
Expand Down Expand Up @@ -2423,6 +2450,7 @@ Users "1" --[#black,dashed,thickness=2]--{ "n" ActivityReportApprovers : user,
Users "1" --[#black,dashed,thickness=2]--{ "n" ActivityReportCollaborators : user, reportCollaborators
Users "1" --[#black,dashed,thickness=2]--{ "n" ActivityReports : author, lastUpdatedBy, reports
Users "1" --[#black,dashed,thickness=2]--{ "n" CommunicationLogs : author, communicationLogs
Users "1" --[#black,dashed,thickness=2]--{ "n" EventReportPilotNationalCenterUsers : user, eventReportPilotNationalCenterUsers
Users "1" --[#black,dashed,thickness=2]--{ "n" GoalCollaborators : user, goalCollaborators
Users "1" --[#black,dashed,thickness=2]--{ "n" GroupCollaborators : user, groupCollaborators
Users "1" --[#black,dashed,thickness=2]--{ "n" NationalCenterUsers : user, nationalCenterUsers
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"browserslist": "^4.16.5",
"cross-fetch": "^3.1.5",
"ejs": "^3.1.7",
"express": "^4.19.2",
"follow-redirects": "^1.15.6",
"json5": "^1.0.2",
"glob-parent": "^6.0.2",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const EMPTY_MULTI_SELECT = {
'is not': [],
};

export const EMPTY_TEXT_INPUT = {
contains: '',
'does not contain': '',
};

export const SPECIALIST_NAME_CONDITIONS = [IS_COLLABORATOR, IS_CREATOR, IS_BOTH];
export const SELECT_CONDITIONS = [CONTAINS, NOT_CONTAINS];
export const FILTER_CONDITIONS = [IS, IS_NOT];
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/filter/__tests__/FilterMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ describe('Filter Menu', () => {
[conditions] = await screen.findAllByRole('combobox', { name: /condition/i });
userEvent.selectOptions(conditions, 'is');

userEvent.selectOptions(topics, 'Goal topics');
userEvent.selectOptions(topics, 'Topics');
[conditions] = await screen.findAllByRole('combobox', { name: /condition/i });
userEvent.selectOptions(conditions, 'is');

Expand All @@ -561,7 +561,7 @@ describe('Filter Menu', () => {
[conditions] = await screen.findAllByRole('combobox', { name: /condition/i });
userEvent.selectOptions(conditions, 'is');

userEvent.selectOptions(topics, 'Goal topics');
userEvent.selectOptions(topics, 'Topics');
[conditions] = await screen.findAllByRole('combobox', { name: /condition/i });
userEvent.selectOptions(conditions, 'is');

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/filter/__tests__/FilterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import userEvent from '@testing-library/user-event';
import FilterPanel from '../FilterPanel';
import UserContext from '../../../UserContext';
import { formatDateRange } from '../../../utils';
import { LANDING_FILTER_CONFIG_WITH_REGIONS } from '../../../pages/Landing/constants';
import { LANDING_FILTER_CONFIG } from '../../../pages/Landing/constants';

const { READ_ACTIVITY_REPORTS } = SCOPE_IDS;
const LANDING_FILTER_CONFIG_WITH_REGIONS = LANDING_FILTER_CONFIG(true);

const defaultDate = formatDateRange({
lastThirtyDays: true,
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/components/filter/__tests__/goalFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
statusFilter,
topicsFilter,
grantNumberFilter,
goalNameFilter,
} from '../goalFilters';
import FilterErrorContext from '../FilterErrorContext';

Expand Down Expand Up @@ -142,4 +143,26 @@ describe('goalFilters', () => {
expect(apply).toHaveBeenCalled();
});
});

describe('goalNameFilter', () => {
it('renders correctly', async () => {
renderFilter(() => goalNameFilter.renderInput('1', 'test', 'text', () => {}));
const input = await screen.findByLabelText('Goal text');
expect(input).toBeInTheDocument();
});

it('displays the correct values', async () => {
const q = goalNameFilter.displayQuery('number');

expect(q).toBe('number');
});

it('calls onApply', async () => {
const apply = jest.fn();
renderFilter(() => goalNameFilter.renderInput('1', 'test', 'test', apply));
const input = await screen.findByLabelText('Goal text');
userEvent.type(input, 'number');
expect(apply).toHaveBeenCalled();
});
});
});
6 changes: 1 addition & 5 deletions frontend/src/components/filter/activityReportFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MY_REPORTS_FILTER_CONDITIONS,
SINGLE_OR_MULTI_RECIPIENT_CONDITIONS,
SPECIALIST_NAME_CONDITIONS,
EMPTY_TEXT_INPUT,
} from '../../Constants';
import FilterDateRange from './FilterDateRange';
import FilterInput from './FilterInput';
Expand Down Expand Up @@ -46,11 +47,6 @@ const EMPTY_SINGLE_SELECT = {
'is not': '',
};

const EMPTY_TEXT_INPUT = {
contains: '',
'does not contain': '',
};

const handleStringQuery = (q) => q;

const LAST_THIRTY_DAYS = formatDateRange({ lastThirtyDays: true, forDateTime: true });
Expand Down
21 changes: 20 additions & 1 deletion frontend/src/components/filter/goalFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import {
DATE_CONDITIONS,
FILTER_CONDITIONS,
EMPTY_MULTI_SELECT,
EMPTY_TEXT_INPUT,
SELECT_CONDITIONS,
} from '../../Constants';
import FilterDateRange from './FilterDateRange';
import FilterReasonSelect from './FilterReasonSelect';
import FilterTopicSelect from './FilterTopicSelect';
import FilterStatus from './FilterStatus';
import FilterSelect from './FilterSelect';
import FilterInput from './FilterInput';
import { handleArrayQuery } from './helpers';
import FilterRoles from './FilterRoles';

Expand Down Expand Up @@ -78,7 +81,7 @@ export const statusFilter = {

export const topicsFilter = {
id: 'topic',
display: 'Goal topics',
display: 'Topics',
conditions: FILTER_CONDITIONS,
defaultValues: EMPTY_MULTI_SELECT,
displayQuery: handleArrayQuery,
Expand Down Expand Up @@ -106,6 +109,22 @@ export const userRolesFilter = {
),
};

export const goalNameFilter = {
id: 'goalName',
display: 'Goal text',
conditions: SELECT_CONDITIONS,
defaultValues: EMPTY_TEXT_INPUT,
displayQuery: (q) => q,
renderInput: (id, condition, query, onApplyQuery) => (
<FilterInput
query={query}
inputId={`reportText-${condition}-${id}`}
onApply={onApplyQuery}
label="Goal text"
/>
),
};

export const grantNumberFilter = (possibleGrants) => ({
id: 'grantNumber',
display: 'Grant number',
Expand Down
81 changes: 31 additions & 50 deletions frontend/src/pages/Landing/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/prefer-default-export */
import {
regionFilter,
endDateFilter,
Expand All @@ -20,58 +21,38 @@ import {
ttaTypeFilter,
activityReportGoalResponseFilter,
} from '../../components/filter/activityReportFilters';
import { goalNameFilter } from '../../components/filter/goalFilters';

import { groupsFilter } from '../../components/filter/grantFilters';

const LANDING_BASE_FILTER_CONFIG = [
startDateFilter,
endDateFilter,
activityReportGoalResponseFilter,
grantNumberFilter,
groupsFilter,
myReportsFilter,
otherEntitiesFilter,
participantsFilter,
programSpecialistFilter,
programTypeFilter,
reasonsFilter,
recipientFilter,
reportIdFilter,
reportTextFilter,
specialistRoleFilter,
singleOrMultiRecipientsFilter,
stateCodeFilter,
targetPopulationsFilter,
topicsFilter,
ttaTypeFilter,
];

const LANDING_FILTER_CONFIG_WITH_REGIONS = [
startDateFilter,
endDateFilter,
activityReportGoalResponseFilter,
grantNumberFilter,
groupsFilter,
myReportsFilter,
otherEntitiesFilter,
participantsFilter,
programSpecialistFilter,
programTypeFilter,
reasonsFilter,
recipientFilter,
regionFilter,
reportIdFilter,
reportTextFilter,
singleOrMultiRecipientsFilter,
specialistRoleFilter,
stateCodeFilter,
targetPopulationsFilter,
topicsFilter,
ttaTypeFilter,
];
export const LANDING_FILTER_CONFIG = (withRegions = false) => {
const LANDING_BASE_FILTER_CONFIG = [
startDateFilter,
endDateFilter,
activityReportGoalResponseFilter,
grantNumberFilter,
groupsFilter,
goalNameFilter,
myReportsFilter,
otherEntitiesFilter,
participantsFilter,
programSpecialistFilter,
programTypeFilter,
reasonsFilter,
recipientFilter,
reportIdFilter,
reportTextFilter,
specialistRoleFilter,
singleOrMultiRecipientsFilter,
stateCodeFilter,
targetPopulationsFilter,
topicsFilter,
ttaTypeFilter,
];

// sort both by display prop
LANDING_BASE_FILTER_CONFIG.sort((a, b) => a.display.localeCompare(b.display));
LANDING_FILTER_CONFIG_WITH_REGIONS.sort((a, b) => a.display.localeCompare(b.display));
if (withRegions) {
LANDING_BASE_FILTER_CONFIG.push(regionFilter);
}

export { LANDING_BASE_FILTER_CONFIG, LANDING_FILTER_CONFIG_WITH_REGIONS };
return LANDING_BASE_FILTER_CONFIG.sort((a, b) => a.display.localeCompare(b.display));
};
5 changes: 2 additions & 3 deletions frontend/src/pages/Landing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import './TouchPoints.css';
import ActivityReportsTable from '../../components/ActivityReportsTable';
import FilterPanel from '../../components/filter/FilterPanel';
import useSessionFiltersAndReflectInUrl from '../../hooks/useSessionFiltersAndReflectInUrl';
import { LANDING_BASE_FILTER_CONFIG, LANDING_FILTER_CONFIG_WITH_REGIONS } from './constants';
import { LANDING_FILTER_CONFIG } from './constants';
import FilterContext from '../../FilterContext';
import RegionPermissionModal from '../../components/RegionPermissionModal';
import { buildDefaultRegionFilters, showFilterWithMyRegions } from '../regionHelpers';
Expand Down Expand Up @@ -244,8 +244,7 @@ function Landing() {
};

const filtersToUse = useMemo(() => {
const filterConfig = hasMultipleRegions
? [...LANDING_FILTER_CONFIG_WITH_REGIONS] : [...LANDING_BASE_FILTER_CONFIG];
const filterConfig = LANDING_FILTER_CONFIG(hasMultipleRegions);

// If user has approve activity report permission add 'Specialist name' filter.
if (hasApproveActivityReport(user)) {
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/pages/RecipientRecord/pages/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ import {
activityReportGoalResponseFilter,
} from '../../../components/filter/activityReportFilters';
import {
statusFilter, createDateFilter, topicsFilter, reasonsFilter, grantNumberFilter, userRolesFilter,
statusFilter,
createDateFilter,
topicsFilter,
reasonsFilter,
grantNumberFilter,
userRolesFilter,
goalNameFilter,
} from '../../../components/filter/goalFilters';

export const getGoalsAndObjectivesFilterConfig = (grantNumberParams) => [
createDateFilter,
goalNameFilter,
grantNumberFilter(grantNumberParams),
reasonsFilter,
statusFilter,
topicsFilter,
userRolesFilter,
];
].sort((a, b) => a.display.localeCompare(b.display));

const TTAHISTORY_FILTER_CONFIG = [
startDateFilter,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/RecipientSearch/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable import/prefer-default-export */
import { regionFilter } from '../../components/filter/activityReportFilters';
import { goalNameFilter } from '../../components/filter/goalFilters';
import { groupsFilter, recipientsWithoutTTA } from '../../components/filter/grantFilters';

const RECIPIENT_SEARCH_FILTER_CONFIG = [
goalNameFilter,
groupsFilter,
regionFilter,
recipientsWithoutTTA,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/RegionalDashboard/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
deliveryMethodFilter,
activityReportGoalResponseFilter,
} from '../../components/filter/activityReportFilters';

import { goalNameFilter } from '../../components/filter/goalFilters';
import { groupsFilter } from '../../components/filter/grantFilters';

const DASHBOARD_FILTER_CONFIG = [
Expand All @@ -31,6 +31,7 @@ const DASHBOARD_FILTER_CONFIG = [
deliveryMethodFilter,
grantNumberFilter,
groupsFilter,
goalNameFilter,
myReportsFilter,
participantsFilter,
programSpecialistFilter,
Expand Down
Loading