Skip to content

Commit

Permalink
use conditional function to add and remove tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Abradat committed Nov 12, 2024
1 parent defad5f commit 8af844d
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1125,16 +1125,11 @@ export class ApplicationSubmissionService {

for (const structureTag of structureTags) {
try {
const tagExists = await this.applicationTagService.applicationHasTag(
await this.conditionallyApplyTag(
applicationSubmission.fileNumber,
structureTypes.has(structureTag),
structureTag,
);

if (!structureTypes.has(structureTag) && tagExists) {
await this.applicationTagService.removeTagFromApplication(applicationSubmission.fileNumber, structureTag);
} else if (structureTypes.has(structureTag) && !tagExists) {
await this.applicationTagService.addTagToApplication(applicationSubmission.fileNumber, structureTag);
}
} catch (e) {
this.logger.error(
`Could not conditionally add tag ${structureTag} to application number ${applicationSubmission.fileNumber} with error: ${e.error}`,
Expand Down

0 comments on commit 8af844d

Please sign in to comment.