Skip to content

Commit

Permalink
there was already a ticdi-45 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgtennant committed Oct 31, 2023
1 parent 1b656c2 commit 9ec1678
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions frontend/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function formatPostalCode(value: string) {
* <city prov postalCode>
*/
export function nfrAddressBuilder(tenantAddr: any[]): string {
const formattedAddresses: string[] = []
const formattedAddresses: string[] = [];
for (const addressObj of tenantAddr) {
const {
legalName,
Expand All @@ -47,10 +47,9 @@ export function nfrAddressBuilder(tenantAddr: any[]): string {
provAbbr,
postalCode,
} = addressObj;
console.log(addressObj)
const formattedAddress: string[] = [];

let name = null;

if (legalName) {
name = legalName;
} else if (firstName || middleName || lastName) {
Expand All @@ -60,16 +59,6 @@ export function nfrAddressBuilder(tenantAddr: any[]): string {
);
name = filteredParts.join(" ");
}
let addrLines = '';
if (addrLine1 && addrLine1.length > 0) {
addrLines = addrLine1;
}
if (addrLine2 && addrLine2.length > 0) {
addrLines = [addrLines, addrLine2].join('\n');
}
if (addrLine3 && addrLine3.length > 0) {
addrLines = [addrLines, addrLine3].join('\n');
}

const parts = [];
if (city) {
Expand All @@ -83,8 +72,12 @@ export function nfrAddressBuilder(tenantAddr: any[]): string {
}
const address = parts.join(" ");

// combine name, addrLines, and address
formattedAddresses.push([name, addrLines, address].join('\n'));
formattedAddress.push(name);
if (addrLine1) formattedAddress.push(addrLine1);
if (addrLine2) formattedAddress.push(addrLine2);
if (addrLine3) formattedAddress.push(addrLine3);
formattedAddress.push(address);
formattedAddresses.push(formattedAddress.join("\n"));
}
return formattedAddresses.join("\n");
}
Expand Down

0 comments on commit 9ec1678

Please sign in to comment.