Skip to content

Commit

Permalink
Merge pull request #5999 from NMDSdevopsServiceAdm/fix/empType
Browse files Browse the repository at this point in the history
Add logs to see why employer type is showing here
  • Loading branch information
Zuhal-Ayob authored Dec 4, 2023
2 parents ff4e349 + 67d1313 commit 7e4df0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/models/classes/establishment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions server/services/establishment/establishment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -197,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"
Expand Down Expand Up @@ -224,6 +231,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 7e4df0e

Please sign in to comment.