Skip to content
Snippets Groups Projects
Commit 38ab062a authored by ezsh's avatar ezsh
Browse files

Add employeesIds to the base job class

...and make it function as its sisters are (was a property).
parent 07658d96
No related branches found
No related tags found
1 merge request!5282Issue 1040
...@@ -156,6 +156,14 @@ App.Entity.Facilities.Job = class { ...@@ -156,6 +156,14 @@ App.Entity.Facilities.Job = class {
(acc, cur, idx) => { if (cur.assignment === this.desc.assignment) { acc.push(idx); } return acc; }, []); (acc, cur, idx) => { if (cur.assignment === this.desc.assignment) { acc.push(idx); } return acc; }, []);
} }
/**
* IDs for all slaves that are employed at this job
* @returns {number[]}
*/
employeesIds() {
return this.employees().map(s => s.ID);
}
/** /**
* Tests if slave is broken enough * Tests if slave is broken enough
* @protected * @protected
...@@ -332,7 +340,7 @@ App.Entity.Facilities.Facility = class { ...@@ -332,7 +340,7 @@ App.Entity.Facilities.Facility = class {
* @returns {number} */ * @returns {number} */
get hostedSlaves() { get hostedSlaves() {
const job = this.job(); const job = this.job();
return job ? job.employeesIds.length : 0; return job ? job.employeesIds().length : 0;
} }
get hasFreeSpace() { get hasFreeSpace() {
...@@ -560,7 +568,7 @@ App.Entity.Facilities.FacilitySingleJob = class extends App.Entity.Facilities.Jo ...@@ -560,7 +568,7 @@ App.Entity.Facilities.FacilitySingleJob = class extends App.Entity.Facilities.Jo
return ids.map(id => si[id]); return ids.map(id => si[id]);
} }
get employeesIds() { employeesIds() {
return State.variables[this._employeeIDsVariableName]; // updated by assignJob()/removeJob(); return State.variables[this._employeeIDsVariableName]; // updated by assignJob()/removeJob();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment