diff --git a/angular/projects/public-nrpti/src/app/records/records-row/records-table-row.component.ts b/angular/projects/public-nrpti/src/app/records/records-row/records-table-row.component.ts index fab4a4023..be7f251bb 100644 --- a/angular/projects/public-nrpti/src/app/records/records-row/records-table-row.component.ts +++ b/angular/projects/public-nrpti/src/app/records/records-row/records-table-row.component.ts @@ -70,6 +70,7 @@ export class RecordsTableRowComponent extends TableRowComponent implements OnIni if (this.rowData.legislation && this.rowData.legislation[0] && this.rowData.legislation[0].offence) { this.description = this.rowData.legislation[0].offence || '-'; } + } else { if (this.rowData.legislation && this.rowData.legislation[0] && diff --git a/api/src/importers/alc/utils/csv-utils.js b/api/src/importers/alc/utils/csv-utils.js index ae297f1aa..13a25e697 100644 --- a/api/src/importers/alc/utils/csv-utils.js +++ b/api/src/importers/alc/utils/csv-utils.js @@ -29,11 +29,25 @@ exports.getOutcomeDescription = function(csvRow) { * @returns {string} the entity type. */ exports.getEntityType = function(csvRow) { + let options = ["Ltd.", "Ltd", "Inc.", "Inc", "Corp.", "Corp"]; + + function endsWithBusinessType(value, endings){ + for (const ending of endings) { + const pattern = new RegExp(`${ending}$`, 'i'); + if (pattern.test(value)) { + return true; + } + } + return false + } + + if (!csvRow) { return null; } - - if (csvRow['inspection property owner']) return MiscConstants.IssuedToEntityTypes.Company; + if (endsWithBusinessType(csvRow['inspection property owner'], options)){ + return MiscConstants.IssuedToEntityTypes.Company; + } return MiscConstants.IssuedToEntityTypes.Individual; };