Skip to content

Commit

Permalink
fix: uptade how stfc email handler assign email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mutambaraf committed Oct 31, 2022
1 parent 72fabfc commit d897755
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,16 @@ export async function stfcEmailHandler(event: ApplicationEvent) {

return;
}

const instrument = instruments[0].name;

let piEmailTemplate: string;

const isIsis = instrument === 'ISIS';

const isRapidAccess =
isIsis && call?.shortCode?.toLowerCase().includes('rapid');

if (isIsis) {
piEmailTemplate = 'isis-proposal-submitted-pi';
} else if (isRapidAccess) {
piEmailTemplate = 'isis-rapid-proposal-submitted-pi';
call?.shortCode?.toLowerCase().includes('rapid') || false;
if (instruments[0].name === 'ISIS') {
piEmailTemplate = isRapidAccess
? 'isis-rapid-proposal-submitted-pi'
: 'isis-proposal-submitted-pi';
} else {
piEmailTemplate = 'clf-proposal-submitted-pi';
}

const principalInvestigator = await userDataSource.getUser(
event.proposal.proposerId
);
Expand Down

0 comments on commit d897755

Please sign in to comment.