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] TTAHUB-3370 Support ticket fix for 'createdHere' ar objectives #2353

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading