From f111e5b3e8bca7a5c2b5d4654bfa1ab0211b444f Mon Sep 17 00:00:00 2001 From: sggerard Date: Wed, 12 Jun 2024 15:51:09 -0700 Subject: [PATCH 1/2] Check legislation act codes in CSV export --- .../src/app/records/utils/record-utils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts b/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts index 4ac6603f7..1b80fffa7 100644 --- a/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts +++ b/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts @@ -11,6 +11,7 @@ import { CourtConvictionDetailComponent } from '../court-convictions/court-convi import { Penalty } from '../../../../../common/src/app/models/master/common-models/penalty'; import { AgencyDataService } from '../../../../../global/src/lib/utils/agency-data-service-nrced'; import { FactoryService } from '../../services/factory.service'; +import { ActDataServiceNRCED } from '../../../../../global/src/lib/utils/act-data-service-nrced'; export class RecordUtils { /** * Given a record type, return the matching detail component type, or null if no matching component found. @@ -127,6 +128,7 @@ export class RecordUtils { output = `${csvHeaders.join(',')}\n`; const agencyDataService = new AgencyDataService(factoryService); + const dataService = new ActDataServiceNRCED(factoryService); for (const row of data) { let line = []; @@ -150,7 +152,14 @@ export class RecordUtils { const legislation = Array.isArray(row['legislation']) ? row['legislation'][0] : row['legislation']; if (legislation) { - line.push(escapeCsvString(legislation['act'])); + if(legislation['act'] && legislation['act'].startsWith("ACT_")){ + const actTitle = dataService.displayActTitleFull(legislation['act']); + if(actTitle){ + line.push(escapeCsvString(actTitle)); + } + } else { + line.push(escapeCsvString(legislation['act'])); + } line.push(escapeCsvString(legislation['regulation'])); line.push(escapeCsvString(legislation['section'])); line.push(escapeCsvString(legislation['subSection'])); From fae54cc896f3007d38069c56a8ed24dfca828ec3 Mon Sep 17 00:00:00 2001 From: acatchpole Date: Wed, 12 Jun 2024 16:27:00 -0700 Subject: [PATCH 2/2] lint fixes --- .../projects/admin-nrpti/src/app/records/records-resolver.ts | 5 +---- .../public-nrpti/src/app/records/utils/record-utils.ts | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/angular/projects/admin-nrpti/src/app/records/records-resolver.ts b/angular/projects/admin-nrpti/src/app/records/records-resolver.ts index c38248758..f7eae2b86 100644 --- a/angular/projects/admin-nrpti/src/app/records/records-resolver.ts +++ b/angular/projects/admin-nrpti/src/app/records/records-resolver.ts @@ -7,10 +7,7 @@ import { EpicProjectIds, SchemaLists } from '../../../../common/src/app/utils/re @Injectable() export class RecordsResolver implements Resolve> { - constructor( - private factoryService: FactoryService, - private tableTemplateUtils: TableTemplateUtils - ) {} + constructor(private factoryService: FactoryService, private tableTemplateUtils: TableTemplateUtils) {} resolve(route: ActivatedRouteSnapshot): Observable { const params = { ...route.params }; diff --git a/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts b/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts index 1b80fffa7..017b359eb 100644 --- a/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts +++ b/angular/projects/public-nrpti/src/app/records/utils/record-utils.ts @@ -152,9 +152,9 @@ export class RecordUtils { const legislation = Array.isArray(row['legislation']) ? row['legislation'][0] : row['legislation']; if (legislation) { - if(legislation['act'] && legislation['act'].startsWith("ACT_")){ + if (legislation['act'] && legislation['act'].startsWith('ACT_')) { const actTitle = dataService.displayActTitleFull(legislation['act']); - if(actTitle){ + if (actTitle) { line.push(escapeCsvString(actTitle)); } } else { @@ -197,7 +197,6 @@ export class RecordUtils { download(`nrced-export-${moment().format('YYYY-MM-DD')}.csv`, output); } - } /**