main.js
/**
 * It's the main function, what more do you need to know.
 */
It's the main function, what more do you need to know.
It ' s the main function what more do you need to know .
function main() {
    const sheets = getSheets();
    const matcher = new Matcher();
    const workshopData = getSheetData(sheets.workshops);
    for (let i = 1; i < workshopData.length; i++) {
        const name = workshopData[i][WORKSHOP_COLUMNS.name];
        const number = i;
        const capacity = workshopData[i][WORKSHOP_COLUMNS.capacity];
        const location =
            workshopData[i][WORKSHOP_COLUMNS.building] +
            " " +
            workshopData[i][WORKSHOP_COLUMNS.room];
        workshopInputChecker(name, capacity, location, i);
        matcher.addNewWorkshop(name, number, capacity, location);
    }
    const responseData = getSheetData(sheets.responses);
    for (let j = 1; j < responseData.length; j++) {
        const firstName = responseData[j][RESPONSE_COLUMNS.firstName];
        const lastName = responseData[j][RESPONSE_COLUMNS.lastName];
        const grade = responseData[j][RESPONSE_COLUMNS.grade];
        studentInputChecker(firstName, lastName, grade, j);
        const preferenceNums = [];
        for (let k = 0; k < PREFERENCE_COLUMNS.length; k++) {
            const preferredWorkshop = responseData[j][PREFERENCE_COLUMNS[k]];
            const workshopNum = parseInt(
                preferredWorkshop.slice(
                    preferredWorkshop.indexOf("(") + 1,
                    preferredWorkshop.indexOf(")")
                ),
                10 
            );
            preferenceInputChecker(workshopNum, j, k);
            if (preferenceNums.indexOf(workshopNum) === -1) {
                preferenceNums.push(workshopNum);
            }
        }
        matcher.addNewStudent(firstName, lastName, preferenceNums, grade);
    }
    const preAssignmentData = getSheetData(sheets.preAssignment);
    for (let l = 1; l < preAssignmentData.length; l++) {
        const firstName = preAssignmentData[l][COLUMN_FIRST_NAMEP];
        const lastName = preAssignmentData[l][COLUMN_LAST_NAMEP];
        const grade = preAssignmentData[l][COLUMN_GRADEP];
        const assignments = [];
        for (let m = 0; m < COLUMN_ASSIGNMENTS.length; m++) {
            assignments.push(preAssignmentData[l][COLUMN_ASSIGNMENTS[m]]);
        }
        matcher.addPreassignedStudent(firstName, lastName, grade, assignments);
    }
    populateSheet(sheets.output, matcher);
    populateMetaSheet(sheets.meta, matcher);
}
function main ( ) { const sheets = getSheets ( ) ; const matcher = new Matcher ( ) ; const workshopData = getSheetData ( sheets . workshops ) ; for ( let i = 1 ; i < workshopData . length ; i ++ ) { const name = workshopData [ i ] [ WORKSHOP_COLUMNS . name ] ; const number = i ; const capacity = workshopData [ i ] [ WORKSHOP_COLUMNS . capacity ] ; const location = workshopData [ i ] [ WORKSHOP_COLUMNS . building ] + " " + workshopData [ i ] [ WORKSHOP_COLUMNS . room ] ; workshopInputChecker ( name , capacity , location , i ) ; matcher . addNewWorkshop ( name , number , capacity , location ) ; } const responseData = getSheetData ( sheets . responses ) ; for ( let j = 1 ; j < responseData . length ; j ++ ) { const firstName = responseData [ j ] [ RESPONSE_COLUMNS . firstName ] ; const lastName = responseData [ j ] [ RESPONSE_COLUMNS . lastName ] ; const grade = responseData [ j ] [ RESPONSE_COLUMNS . grade ] ; studentInputChecker ( firstName , lastName , grade , j ) ; const preferenceNums = [ ] ; for ( let k = 0 ; k < PREFERENCE_COLUMNS . length ; k ++ ) { const preferredWorkshop = responseData [ j ] [ PREFERENCE_COLUMNS [ k ] ] ; const workshopNum = parseInt ( preferredWorkshop . slice ( preferredWorkshop . indexOf ( "(" ) + 1 , preferredWorkshop . indexOf ( ")" ) ) , 10 ) ; preferenceInputChecker ( workshopNum , j , k ) ; if ( preferenceNums . indexOf ( workshopNum ) === - 1 ) { preferenceNums . push ( workshopNum ) ; } } matcher . addNewStudent ( firstName , lastName , preferenceNums , grade ) ; } const preAssignmentData = getSheetData ( sheets . preAssignment ) ; for ( let l = 1 ; l < preAssignmentData . length ; l ++ ) { const firstName = preAssignmentData [ l ] [ COLUMN_FIRST_NAMEP ] ; const lastName = preAssignmentData [ l ] [ COLUMN_LAST_NAMEP ] ; const grade = preAssignmentData [ l ] [ COLUMN_GRADEP ] ; const assignments = [ ] ; for ( let m = 0 ; m < COLUMN_ASSIGNMENTS . length ; m ++ ) { assignments . push ( preAssignmentData [ l ] [ COLUMN_ASSIGNMENTS [ m ] ] ) ; } matcher . addPreassignedStudent ( firstName , lastName , grade , assignments ) ; } populateSheet ( sheets . output , matcher ) ; populateMetaSheet ( sheets . meta , matcher ) ; }
It's the main function, what more do you need to know.
It ' s the main function what more do you need to know .
// for all workshops i // for all students j // for all student preferences k // base 10 // For all preassignements l //for each Assignment m