Skip to content

Commit 8723383

Browse files
authored
feat: add waitlist lottery translation for the confirmation email (#5611)
* feat: add waitlist lottery translation for the confirmation email * test: waitlistLottery condition for the confirmation email
1 parent 7db0995 commit 8723383

4 files changed

Lines changed: 68 additions & 1 deletion

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Adds new waitlist lottery confirmation translations for emails.
2+
3+
UPDATE translations
4+
SET translations = jsonb_set(translations, '{confirmation,eligible,waitlistLottery}', '"Eligible applicants will be placed on the waitlist based on lottery rank order."')
5+
WHERE language = 'en';
6+
7+
UPDATE translations
8+
SET translations = jsonb_set(translations, '{confirmation,eligible,waitlistLottery}', '"Los solicitantes elegibles serán colocados en la lista de espera según el orden de clasificación de la lotería."')
9+
WHERE language = 'es';
10+
11+
UPDATE translations
12+
SET translations = jsonb_set(translations, '{confirmation,eligible,waitlistLottery}', '"Ang mga karapat-dapat na aplikante ay ilalagay sa waitlist batay sa order ng ranggo ng lottery."')
13+
WHERE language = 'tl';
14+
15+
UPDATE translations
16+
SET translations = jsonb_set(translations, '{confirmation,eligible,waitlistLottery}', '"Những người nộp đơn đủ điều kiện sẽ được đưa vào danh sách chờ dựa trên thứ hạng xổ số."')
17+
WHERE language = 'vi';
18+
19+
UPDATE translations
20+
SET translations = jsonb_set(translations, '{confirmation,eligible,waitlistLottery}', '"符合資格的申請人將根據抽籤順序列入候補名單。"')
21+
WHERE language = 'zh';

api/prisma/seed-helpers/translation-factory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const translations = (jurisdictionName?: string, language?: LanguagesEnum) => {
5353
'Once the application period closes, eligible applicants will be placed in order based on lottery rank order.',
5454
waitlist:
5555
'Eligible applicants will be placed on the waitlist on a first come first serve basis until waitlist spots are filled.',
56+
waitlistLottery:
57+
'Eligible applicants will be placed on the waitlist based on lottery rank order.',
5658
fcfsPreference:
5759
'Housing preferences, if applicable, will affect first come first serve order.',
5860
waitlistContact:

api/src/services/email.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ export class EmailService {
376376
'confirmation.eligible.fcfsPreference',
377377
);
378378
} else if (hasUnitGroups) {
379-
eligibleText = this.polyglot.t('confirmation.eligible.waitlist');
379+
if (listing.reviewOrderType === ReviewOrderTypeEnum.waitlistLottery) {
380+
eligibleText = this.polyglot.t('confirmation.eligible.waitlistLottery');
381+
} else {
382+
eligibleText = this.polyglot.t('confirmation.eligible.waitlist');
383+
}
380384
contactText = this.polyglot.t('confirmation.eligible.waitlistContact');
381385
preferenceText = this.polyglot.t(
382386
'confirmation.eligible.waitlistPreference',
@@ -402,6 +406,13 @@ export class EmailService {
402406
'confirmation.eligible.waitlistPreference',
403407
);
404408
}
409+
if (listing.reviewOrderType === ReviewOrderTypeEnum.waitlistLottery) {
410+
eligibleText = this.polyglot.t('confirmation.eligible.waitlistLottery');
411+
contactText = this.polyglot.t('confirmation.eligible.waitlistContact');
412+
preferenceText = this.polyglot.t(
413+
'confirmation.eligible.waitlistPreference',
414+
);
415+
}
405416
}
406417

407418
const user = {

api/test/unit/services/email.service.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,39 @@ describe('Testing email service', () => {
348348
'You may be contacted while on the waitlist to confirm that you wish to remain on the waitlist',
349349
);
350350
});
351+
it('Test waitlistLottery', async () => {
352+
await service.applicationConfirmation(
353+
{ ...listing, reviewOrderType: ReviewOrderTypeEnum.waitlistLottery },
354+
application as ApplicationCreate,
355+
'http://localhost:3001',
356+
);
357+
expect(sendMock).toHaveBeenCalled();
358+
expect(sendMock.mock.calls[0][0].to).toEqual(
359+
'applicant.email@example.com',
360+
);
361+
expect(sendMock.mock.calls[0][0].subject).toEqual(
362+
'Your Application Confirmation',
363+
);
364+
expect(sendMock.mock.calls[0][0].html).toContain(
365+
'<td class="step step-complete"><img src="https://res.cloudinary.com/exygy/image/upload/v1652459517/core/step-left-active_vo3fnq.png" alt="indication of step completed" /></td>',
366+
);
367+
expect(sendMock.mock.calls[0][0].html).toContain(
368+
'<td class="step step-complete"><span class="step-label" aria-current="true">Application <br />received</span></td>',
369+
);
370+
expect(sendMock.mock.calls[0][0].html).toContain('What happens next?');
371+
expect(sendMock.mock.calls[0][0].html).toContain(
372+
'Eligible applicants will be placed on the waitlist based on lottery rank order.',
373+
);
374+
expect(sendMock.mock.calls[0][0].html).toContain(
375+
'Housing preferences, if applicable, will affect waitlist order.',
376+
);
377+
expect(sendMock.mock.calls[0][0].html).toContain(
378+
'If you are contacted for an interview, you will be asked to fill out a more detailed application and provide supporting documents',
379+
);
380+
expect(sendMock.mock.calls[0][0].html).toContain(
381+
'You may be contacted while on the waitlist to confirm that you wish to remain on the waitlist',
382+
);
383+
});
351384

352385
it('Test leasing agent section with all fields present', async () => {
353386
const listingWithLeasingAgent = {

0 commit comments

Comments
 (0)