Skip to content

Commit

Permalink
Merge pull request LinuxForHealth#3 from volsch/address_text
Browse files Browse the repository at this point in the history
Use address line when no other address details are available.
  • Loading branch information
vlad-ignatov authored Jun 19, 2020
2 parents 352ec8b + 90c6b72 commit eb09cf6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ tests/e2e/screenshots
selenium-debug.log

!.gitkeep
/build/config/*-custom.json5
3 changes: 2 additions & 1 deletion src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,11 @@ export function getPatientEmail(patient = {}) {
export function getPatientHomeAddress(patient = {}) {
let a = (patient.address || []);
a = a.find(c => c.use == "home") || a[0] || {};
return [a.line, a.postalCode, a.city, a.country]
var l = [a.line, a.postalCode, a.city, a.country]
.map(x => String(x || "").trim())
.filter(Boolean)
.join(" ");
return l ? l : a.text || "";
}

/**
Expand Down

0 comments on commit eb09cf6

Please sign in to comment.