From 2b68591558961a983da0c2b50bea213f03971cdf Mon Sep 17 00:00:00 2001 From: Zuhal-Ayob Date: Mon, 4 Dec 2023 11:16:33 +0000 Subject: [PATCH 1/2] Add logs to see why employer type is showing here --- server/services/establishment/establishment.js | 2 ++ .../workplace-info-panel/workplace-info-panel.component.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/server/services/establishment/establishment.js b/server/services/establishment/establishment.js index 68117206c0..a3ca0f369a 100644 --- a/server/services/establishment/establishment.js +++ b/server/services/establishment/establishment.js @@ -189,6 +189,7 @@ const addEstablishment = async (req, res) => { // gets requested establishment // optional parameter - "history" must equal "none" (default), "property", "timeline" or "full" const getEstablishment = async (req, res) => { + console.log('getEstablishment request'); const establishmentId = req.params.id; const showHistory = @@ -224,6 +225,7 @@ const getEstablishment = async (req, res) => { } if (!jsonResponse.isParent && jsonResponse.parentUid !== null) { const parentEstablishmentName = await thisEstablishment.fetchParentDetails(jsonResponse.parentUid); + console.log({ parentEstablishmentName: parentEstablishmentName }); if (parentEstablishmentName) { jsonResponse.parentName = parentEstablishmentName.parentName; } diff --git a/src/app/features/workplace/workplace-info-panel/workplace-info-panel.component.ts b/src/app/features/workplace/workplace-info-panel/workplace-info-panel.component.ts index 835f4d248a..1134ada5ec 100644 --- a/src/app/features/workplace/workplace-info-panel/workplace-info-panel.component.ts +++ b/src/app/features/workplace/workplace-info-panel/workplace-info-panel.component.ts @@ -138,6 +138,7 @@ export class WorkplaceInfoPanelComponent implements OnInit, OnDestroy { event.preventDefault(); this.establishmentService.getEstablishment(this.workplace.uid).subscribe((data) => { + console.log({ workplaceDATA: data }); if (data.employerType == null) { this.establishmentService.setEmployerTypeHasValue(false); this.router.navigate(['/workplace', this.workplace.uid, 'type-of-employer']); From 67d13134309e1b399991adad4e2c7ea540242c0f Mon Sep 17 00:00:00 2001 From: Zuhal-Ayob Date: Mon, 4 Dec 2023 11:28:00 +0000 Subject: [PATCH 2/2] Add logs to the backend --- server/models/classes/establishment.js | 1 + server/services/establishment/establishment.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/server/models/classes/establishment.js b/server/models/classes/establishment.js index 57c4c87340..4478afcaba 100644 --- a/server/models/classes/establishment.js +++ b/server/models/classes/establishment.js @@ -1293,6 +1293,7 @@ class Establishment extends EntityValidator { } const fetchResults = await models.establishment.findOne(fetchQuery); + console.log({ fetchResults: fetchResults }); if (fetchResults && fetchResults.id && Number.isInteger(fetchResults.id)) { // update self - don't use setters because they modify the change state this._isNew = false; diff --git a/server/services/establishment/establishment.js b/server/services/establishment/establishment.js index a3ca0f369a..d93cfe6182 100644 --- a/server/services/establishment/establishment.js +++ b/server/services/establishment/establishment.js @@ -198,6 +198,12 @@ const getEstablishment = async (req, res) => { const showPropertyHistoryOnly = req.query.history === 'property'; const thisEstablishment = new Establishment.Establishment(req.username); + console.log({ + thisEstablishment: thisEstablishment, + establishmentId: establishmentId, + showHistory: showHistory, + history: req.query.history, + }); try { if (await thisEstablishment.restore(establishmentId, showHistory && req.query.history !== 'property')) { // the property based framework for "other services" and "capacity services"