Skip to content

Commit

Permalink
Fix unit without address (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
obieler authored Nov 3, 2023
1 parent 7f7f737 commit 8170e43
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
9 changes: 6 additions & 3 deletions src/services/unit.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ async function getUnit (acro, lang) {
unitPath: dict.hierarchie,
path: unitPath,
terminal: dict.has_accreds,
ghost: dict.ghost,
address: dict.adresse.split('$').map((value) => value.trim())
.filter((value) => value !== '')
ghost: dict.ghost
};
const address = dict.adresse.split('$').map((value) => value.trim())
.filter((value) => value !== '');
if (address.length > 0) {
unitFullDetails.address = address;
}
if (dict.resp_sciper) {
unitFullDetails.head = {
sciper: dict.resp_sciper,
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/cadidb/getUnit-ot.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"resp_prenom_usuel": null,
"url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy",
"faxes": "10121,0216910122",
"adresse": "EPFL OT $ Original trilogy Square $ Station 15 $ CH-1015 Lausanne $ $ ",
"adresse": " $ $ $ $ $ ",
"cmpl_type": "F",
"ghost": null,
"has_accreds": null
Expand Down
6 changes: 0 additions & 6 deletions tests/resources/unit/unit-ot-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
],
"terminal": null,
"ghost": null,
"address": [
"EPFL OT",
"Original trilogy Square",
"Station 15",
"CH-1015 Lausanne"
],
"faxes": ["+41 21 6910121", "+41 21 6910122"],
"url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy",
"subunits": [
Expand Down
6 changes: 0 additions & 6 deletions tests/resources/unit/unit-ot-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
],
"terminal": null,
"ghost": null,
"address": [
"EPFL OT",
"Original trilogy Square",
"Station 15",
"CH-1015 Lausanne"
],
"faxes": ["+41 21 6910121", "+41 21 6910122"],
"url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy",
"subunits": [
Expand Down

0 comments on commit 8170e43

Please sign in to comment.