main.js
/**
 * Output the results of the matcher to the given sheet.
 */
Output the results of the matcher to the given sheet.
Output the results of the matcher to the given sheet .
function populateSheet(outputSheet, matcher) {
    outputSheet.clear();
    outputSheet.appendRow(OUTPUT_SHEET_HEADER);
    outputSheet.setFrozenRows(1);
    matcher.fixStudentPreferences();
    matcher.matchGirls();
    const studentLines = [];
    for (const student of matcher.preAssignedStudents) {
        const studentLine = [];
        studentLine.push(student.firstName);
        studentLine.push(student.lastName);
        studentLine.push(student.grade);
        for (const workshop of student.assignedWorkshops) {
            if (workshop === null) {
                studentLine.push("", "", "");
            } else {
                studentLine.push(workshop.number);
                studentLine.push(workshop.name);
                studentLine.push(workshop.location);
            }
        }
        studentLines.push(studentLine);
    }
    for (const student of matcher.allStudents) {
        const studentLine = [];
        studentLine.push(student.firstName);
        studentLine.push(student.lastName);
        studentLine.push(student.grade);
        for (const workshop of student.assignedWorkshops) {
            if (workshop === null) {
                studentLine.push("", "", "");
            } else {
                studentLine.push(workshop.number);
                studentLine.push(workshop.name);
                studentLine.push(workshop.location);
            }
        }
        studentLines.push(studentLine);
    }
    outputRows(outputSheet, studentLines);
}
function populateSheet ( outputSheet , matcher ) { outputSheet . clear ( ) ; outputSheet . appendRow ( OUTPUT_SHEET_HEADER ) ; outputSheet . setFrozenRows ( 1 ) ; matcher . fixStudentPreferences ( ) ; matcher . matchGirls ( ) ; const studentLines = [ ] ; for ( const student of matcher . preAssignedStudents ) { const studentLine = [ ] ; studentLine . push ( student . firstName ) ; studentLine . push ( student . lastName ) ; studentLine . push ( student . grade ) ; for ( const workshop of student . assignedWorkshops ) { if ( workshop === null ) { studentLine . push ( "" , "" , "" ) ; } else { studentLine . push ( workshop . number ) ; studentLine . push ( workshop . name ) ; studentLine . push ( workshop . location ) ; } } studentLines . push ( studentLine ) ; } for ( const student of matcher . allStudents ) { const studentLine = [ ] ; studentLine . push ( student . firstName ) ; studentLine . push ( student . lastName ) ; studentLine . push ( student . grade ) ; for ( const workshop of student . assignedWorkshops ) { if ( workshop === null ) { studentLine . push ( "" , "" , "" ) ; } else { studentLine . push ( workshop . number ) ; studentLine . push ( workshop . name ) ; studentLine . push ( workshop . location ) ; } } studentLines . push ( studentLine ) ; } outputRows ( outputSheet , studentLines ) ; }
Output the results of the matcher to the given sheet.
Output the results of the matcher to the given sheet .
// All student lines to output // List the student's assigned workshops in the row // List the student's assigned workshops in the row