Skip to content

Commit

Permalink
fix: only set build rule for afs if name exists (#4145)
Browse files Browse the repository at this point in the history
* fix: add null check to afs rule key

* fix: only set build rule if name exists
  • Loading branch information
ludtkemorgan authored Jun 20, 2024
1 parent 34201de commit 05b9c7f
Show file tree
Hide file tree
Showing 3 changed files with 1,963 additions and 1,885 deletions.
13 changes: 10 additions & 3 deletions api/src/services/application-flagged-set.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,11 @@ export class ApplicationFlaggedSetService implements OnModuleInit {
});

const builtRuleKey = this.buildRuleKey(application, rule, listingId);
if (!alreadyFoundMatch && applicationsThatMatched.length) {
if (
!alreadyFoundMatch &&
applicationsThatMatched.length &&
builtRuleKey
) {
// if there were duplicates (application could be a part of a flagged set)
if (flagSetsThisAppBelongsTo.length) {
// if application is part of a flagged set already
Expand Down Expand Up @@ -672,9 +676,12 @@ export class ApplicationFlaggedSetService implements OnModuleInit {
): string {
if (rule == RuleEnum.email) {
return `${listingId}-email-${application.applicant.emailAddress}`;
} else {
} else if (
application.applicant.firstName &&
application.applicant.lastName
) {
return (
`${listingId}-nameAndDOB-${application.applicant.firstName.toLowerCase()}-${application.applicant.lastName.toLowerCase()}` +
`${listingId}-nameAndDOB-${application.applicant.firstName?.toLowerCase()}-${application.applicant.lastName?.toLowerCase()}` +
`-${application.applicant.birthMonth}-${application.applicant.birthDay}-${application.applicant.birthYear}`
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ describe('Testing application CSV export service', () => {
expect(readable).toContain(firstApp);
});

it('should build csv with submission date defaulted to PST', async () => {
it('should build csv with submission date defaulted to TIME_ZONE variable', async () => {
process.env.TIME_ZONE = 'America/Los_Angeles';
jest.useFakeTimers();
jest.setSystemTime(new Date('2024-01-01'));

Expand Down
Loading

0 comments on commit 05b9c7f

Please sign in to comment.