diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 1f793525faabb6bc4ff41c19c6a25a8ea2071302..7beb1a286ea226ddf9cee7d86e555bb38207856a 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -726,28 +726,19 @@ globalThis.assignmentVisible = function(slave) { return true; }; +/** + * @returns {Object.<string, number[]>} dictionary assignment -> slave IDs + */ globalThis.resetJobIDArray = function() { - /* todo: expand to all assignments */ - - const slaves = V.slaves; - const JobIDArray = { - "rest": [], - "please you": [], - "work a glory hole": [], - "take classes": [], - "be a servant": [], - "whore": [], - "serve the public": [], - "get milked": [], - "stay confined": [], - "be a subordinate slave": [] - }; + /** @type {Object.<string, number[]>} */ + const JobIDArray = {}; + for (const jn of Object.values(Job)) { + JobIDArray[jn] = []; + } - slaves.forEach(function(slave) { - if (JobIDArray.hasOwnProperty(slave.assignment)) { - JobIDArray[slave.assignment].push(slave.ID); - } - }); + for (const slave of V.slaves) { + JobIDArray[slave.assignment].push(slave.ID); + } return JobIDArray; };