increment employees the right way (#869)

move the incrementation of employees after the avg calc
This commit is contained in:
Caldwell 2023-10-17 13:07:26 +02:00 committed by GitHub
parent ad03e4ee82
commit 9c41995e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -179,10 +179,6 @@ export class OfficeSpace {
if (this.atCapacity()) return false;
if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) return false;
++this.numEmployees;
++this.employeeJobs[position];
++this.employeeNextJobs[position];
this.totalExperience += getRandomInt(50, 100);
this.avgMorale = (this.avgMorale * this.numEmployees + getRandomInt(50, 100)) / (this.numEmployees + 1);
@ -192,6 +188,10 @@ export class OfficeSpace {
this.avgCharisma = (this.avgCharisma * this.numEmployees + getRandomInt(50, 100)) / (this.numEmployees + 1);
this.avgCreativity = (this.avgCreativity * this.numEmployees + getRandomInt(50, 100)) / (this.numEmployees + 1);
this.avgEfficiency = (this.avgEfficiency * this.numEmployees + getRandomInt(50, 100)) / (this.numEmployees + 1);
++this.numEmployees;
++this.employeeJobs[position];
++this.employeeNextJobs[position];
return true;
}