async function fillOpenPositions(ns, divisionName, cityName) {
    if (options.mock) return;
    let office = ns.corporation.getOffice(divisionName, cityName);
    let employees = office.employees.map((e) => ns.corporation.getEmployee(divisionName, cityName, e));
    let numUnassigned = employees.filter((e) => e.pos === 'Unassigned').length;
    let openJobs = office.size - office.employees.length;
    for (let i = 0; i < openJobs; i++) {
        ns.corporation.hireEmployee(divisionName, cityName);
    }
    openJobs += numUnassigned;
    office = ns.corporation.getOffice(divisionName, cityName);
    if (openJobs > 0) {
        if (verbose) log(ns, `Assigning ${openJobs} new employees to work in ${divisionName}/${cityName}`);
        let employeesPerJob = Math.floor(office.employees.length / jobs.length);
        let employeesLeft = office.employees.length % jobs.length;
        for (let i = 0; i < jobs.length; i++) {
            const job = jobs[i];
            let num = employeesPerJob;
            if (i < employeesLeft) num++;
            // if (verbose) log(ns, `Assigning ${num} employees to work as ${job} in ${cityName}`);
            if (num) await ns.corporation.setAutoJobAssignment(divisionName, cityName, job, num);
        }
    }
}
/**
 * Fill any open positions with employees.
 * @param {NS} ns
 * @param {string} divisionName
 * @param {string} cityName
 */
Fill any open positions with employees.
Fill any open positions with employees .
async function fillOpenPositions(ns, divisionName, cityName) {
    if (options.mock) return;
    let office = ns.corporation.getOffice(divisionName, cityName);
    let employees = office.employees.map((e) => ns.corporation.getEmployee(divisionName, cityName, e));
    let numUnassigned = employees.filter((e) => e.pos === 'Unassigned').length;
    let openJobs = office.size - office.employees.length;
    for (let i = 0; i < openJobs; i++) {
        ns.corporation.hireEmployee(divisionName, cityName);
    }
    openJobs += numUnassigned;
    office = ns.corporation.getOffice(divisionName, cityName);
    if (openJobs > 0) {
        if (verbose) log(ns, `Assigning ${openJobs} new employees to work in ${divisionName}/${cityName}`);
        let employeesPerJob = Math.floor(office.employees.length / jobs.length);
        let employeesLeft = office.employees.length % jobs.length;
        for (let i = 0; i < jobs.length; i++) {
            const job = jobs[i];
            let num = employeesPerJob;
            if (i < employeesLeft) num++;
            if (num) await ns.corporation.setAutoJobAssignment(divisionName, cityName, job, num);
        }
    }
}
async function fillOpenPositions ( ns , divisionName , cityName ) { if ( options . mock ) return ; let office = ns . corporation . getOffice ( divisionName , cityName ) ; let employees = office . employees . map ( ( e ) => ns . corporation . getEmployee ( divisionName , cityName , e ) ) ; let numUnassigned = employees . filter ( ( e ) => e . pos === 'Unassigned' ) . length ; let openJobs = office . size - office . employees . length ; for ( let i = 0 ; i < openJobs ; i ++ ) { ns . corporation . hireEmployee ( divisionName , cityName ) ; } openJobs += numUnassigned ; office = ns . corporation . getOffice ( divisionName , cityName ) ; if ( openJobs > 0 ) { if ( verbose ) log ( ns , ` ${ openJobs } ${ divisionName } ${ cityName } ` ) ; let employeesPerJob = Math . floor ( office . employees . length / jobs . length ) ; let employeesLeft = office . employees . length % jobs . length ; for ( let i = 0 ; i < jobs . length ; i ++ ) { const job = jobs [ i ] ; let num = employeesPerJob ; if ( i < employeesLeft ) num ++ ; if ( num ) await ns . corporation . setAutoJobAssignment ( divisionName , cityName , job , num ) ; } } }
Fill any open positions with employees.
Fill any open positions with employees .
// if (verbose) log(ns, `Assigning ${num} employees to work as ${job} in ${cityName}`);
