From 553e45754989f1582a0922429f86c3e8d808d80d Mon Sep 17 00:00:00 2001 From: ezsh <ezsh.junk@gmail.com> Date: Sat, 24 Jul 2021 14:59:30 +0200 Subject: [PATCH] Fix HG suite page Commit a1b8f50a991e3d90198f29e9987e822d1abb2d08 broke it using the baseName property from the facility description to index the App.Entity.facilities object. In this particular case the baseName is 'HGSuite' and the object property name is 'headGirlSuite'. Please check 'baseName' comment which tells that property is the base name for state variables, rather the object property name in the `App.Entity.facilities`. Fixing the problem by replacing the facility name with the facility object in the removeFacilityWorkers() parameters. --- src/004-base/facilityFramework.js | 2 +- src/facilities/nursery/nursery.tw | 2 +- src/js/assignJS.js | 5 ++--- src/uncategorized/dairy.tw | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/004-base/facilityFramework.js b/src/004-base/facilityFramework.js index 1bda1a2deeb..0e560b476bd 100644 --- a/src/004-base/facilityFramework.js +++ b/src/004-base/facilityFramework.js @@ -155,7 +155,7 @@ App.Facilities.Facility = class { } if (this.facility.totalEmployeesCount > 0) { - App.UI.DOM.appendNewElement("div", div, this.expand.removeAll || removeFacilityWorkers(this.facility.desc.baseName, this.expand.removeManager, this.expand.removeSlave), ['indent']); + App.UI.DOM.appendNewElement("div", div, this.expand.removeAll || removeFacilityWorkers(this.facility, this.expand.removeManager, this.expand.removeSlave), ['indent']); } } diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw index 11c9054aab5..af80183f271 100644 --- a/src/facilities/nursery/nursery.tw +++ b/src/facilities/nursery/nursery.tw @@ -128,7 +128,7 @@ <div class="choices"> <<if _NL > 0>> - <<includeDOM removeFacilityWorkers("nursery", "rest", "rest")>> + <<includeDOM removeFacilityWorkers(App.Entity.facilities.nursery, "rest", "rest")>> <</if>> </div> diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 2cfb62b088b..8ef3d419636 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -943,13 +943,12 @@ globalThis.assignmentTransition = function(slave, assignTo, passage) { /** * Creates a link that will remove all slaves from a facility, including manager. - * @param {string} facilityName + * @param {App.Entity.Facilities.Facility} facility * @param {FC.Assignment} [managerAssignment] * @param {FC.Assignment} [workerAssignment] * @returns {DocumentFragment} */ -globalThis.removeFacilityWorkers = function(facilityName, managerAssignment, workerAssignment) { - const facility = App.Entity.facilities[facilityName]; +globalThis.removeFacilityWorkers = function(facility, managerAssignment, workerAssignment) { const count = facility.totalEmployeesCount; const frag = new DocumentFragment(); if (count > 0) { diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw index 77190bc5bff..640200d3c63 100644 --- a/src/uncategorized/dairy.tw +++ b/src/uncategorized/dairy.tw @@ -355,7 +355,7 @@ </div> <div class="choices"> <<if _DL > 0>> - <<includeDOM removeFacilityWorkers("dairy", "rest", "get milked")>> + <<includeDOM removeFacilityWorkers(App.Entity.facilities.dairy, "rest", "get milked")>> <</if>> </div> </div> -- GitLab