Skip to content

Commit

Permalink
chore: enable screening assignment email
Browse files Browse the repository at this point in the history
  • Loading branch information
RRanath committed Sep 23, 2024
1 parent 92b19ce commit b618df8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/backend/lib/emails/templates/assessmentAssigneeChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ const assessmentAssigneeChange: EmailTemplateProvider = async (
};
});
return {
assignors: ccbcAssignorUserList[assignor],
assignors: ccbcAssignorUserList?.[assignor] || 'A CCBC Analyst',
alerts,
};
}
);
// Get the list of assignors for the email
const assignorList = Object.keys(assignmentsByAssignor).map(
(key) => ccbcAssignorUserList[key]
(key) => ccbcAssignorUserList?.[key] || 'A CCBC Analyst'
);

return {
Expand Down
7 changes: 7 additions & 0 deletions app/components/AnalystDashboard/AssessmentAssignmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ const AssessmentAssignmentTable: React.FC<Props> = ({ query }) => {
application.allAssessments.edges,
'screening'
),
screeningNotification: findNotification(
application.assessmentNotifications.edges,
'assignment_screening'
),
financialRiskAssessment: findAssessment(
application.allAssessments.edges,
'financialRisk'
Expand Down Expand Up @@ -509,6 +513,7 @@ const AssessmentAssignmentTable: React.FC<Props> = ({ query }) => {

const assessmentChanged =
jsonData?.assignedTo &&
jsonData.assignedTo !== 'Unassigned' &&
jsonData.assignedTo !== notification?.jsonData?.to;

if (new Date(updatedAt) >= lastNotificationSentAt && assessmentChanged) {
Expand Down Expand Up @@ -537,10 +542,12 @@ const AssessmentAssignmentTable: React.FC<Props> = ({ query }) => {
'pm',
'projectManagement'
);
const screeningAssignment = createAssignment(application, 'screening');

if (techAssignment) assignmentsList.push(techAssignment);
if (financialAssignment) assignmentsList.push(financialAssignment);
if (pmAssignment) assignmentsList.push(pmAssignment);
if (screeningAssignment) assignmentsList.push(screeningAssignment);

return assignmentsList;
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('assessmentAssigneeChange template', () => {
},
{
applicationId: 2,
assessmentType: 'technical',
assessmentType: 'screening',
assignedTo: 'Tester 2',
assigneeEmail: 'tester2@mail.com',
ccbcNumber: 'CCBC-000002',
Expand Down Expand Up @@ -106,8 +106,8 @@ describe('assessmentAssigneeChange template', () => {
{
ccbcNumber: 'CCBC-000002',
applicationId: 2,
type: 'Technical assessment',
url: 'http://mock_host.ca/analyst/application/2/assessments/technical',
type: 'Eligibility Screening',
url: 'http://mock_host.ca/analyst/application/2/assessments/screening',
},
],
assignors: 'Assignor 2',
Expand Down

0 comments on commit b618df8

Please sign in to comment.