Skip to content

Commit

Permalink
Merge pull request #2353 from HHS/main
Browse files Browse the repository at this point in the history
[PROD] TTAHUB-3370 Support ticket fix for 'createdHere' ar objectives
  • Loading branch information
Jones-QuarteyDana authored Sep 5, 2024
2 parents 98b9a9a + ec1a36a commit 8ff06aa
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
109 changes: 109 additions & 0 deletions frontend/src/pages/ActivityReport/__tests__/formDataHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,115 @@ describe('FormDataHelpers', () => {
},
]);
});

it('correctly pacakges all objective fields', () => {
const grantIds = [1];
const packagedGoals = packageGoals(
[
{
...baseGoal,
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
objectives: [
{
id: 1,
isNew: false,
ttaProvided: 'Not Created Here TTA',
title: 'Not Created Here Title',
status: 'status',
resources: 'resources',
topics: 'topics',
files: 'files',
supportType: 'supportType',
courses: 'courses',
closeSuspendReason: 'closeSuspendReason',
closeSuspendContext: 'closeSuspendContext',
createdHere: false,
},
],
},
],
{
...baseGoal,
name: 'recipient',
endDate: '09/01/2020',
isActivelyBeingEditing: true,
objectives: [
{
id: 2,
isNew: false,
ttaProvided: 'Created Here TTA',
title: 'Created Here Title',
status: 'status',
resources: 'resources',
topics: 'topics',
files: 'files',
supportType: 'supportType',
courses: 'courses',
closeSuspendReason: 'closeSuspendReason',
closeSuspendContext: 'closeSuspendContext',
createdHere: true,
},
],
},
grantIds,
[{ fieldName: 'prompt2' }],
);

expect(packagedGoals).toEqual([
{
...baseGoal,
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
grantIds,
isActivelyBeingEditing: false,
objectives: [
{
id: 1,
isNew: false,
ttaProvided: 'Not Created Here TTA',
title: 'Not Created Here Title',
status: 'status',
resources: 'resources',
topics: 'topics',
files: 'files',
supportType: 'supportType',
courses: 'courses',
closeSuspendReason: 'closeSuspendReason',
closeSuspendContext: 'closeSuspendContext',
createdHere: false,
},
],
},
{
...baseGoal,
name: 'recipient',
endDate: '09/01/2020',
isActivelyBeingEditing: true,
grantIds,
prompts: [{ fieldName: 'prompt2' }],
objectives: [
{
id: 2,
isNew: false,
ttaProvided: 'Created Here TTA',
title: 'Created Here Title',
status: 'status',
resources: 'resources',
topics: 'topics',
files: 'files',
supportType: 'supportType',
courses: 'courses',
closeSuspendReason: 'closeSuspendReason',
closeSuspendContext: 'closeSuspendContext',
createdHere: true,
},
],
},
]);
});
});

describe('convertGoalsToFormData', () => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/ActivityReport/formDataHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const packageGoals = (goals, goal, grantIds, prompts) => {
courses: objective.courses,
closeSuspendReason: objective.closeSuspendReason,
closeSuspendContext: objective.closeSuspendContext,
createdHere: objective.createdHere,
})),
})),
];
Expand All @@ -155,6 +156,7 @@ export const packageGoals = (goals, goal, grantIds, prompts) => {
courses: objective.courses,
closeSuspendReason: objective.closeSuspendReason,
closeSuspendContext: objective.closeSuspendContext,
createdHere: objective.createdHere,
})),
grantIds,
prompts: grantIds.length < 2 ? prompts : [],
Expand Down

0 comments on commit 8ff06aa

Please sign in to comment.