Student.js
/**
     * Calculates and returns the "score" of this student's assigned workshops based on their preferences.
     */
Calculates and returns the "score" of this student's assigned workshops based on their preferences.
Calculates and returns the " score " of this student ' s assigned workshops based on their preferences .
calculateScore() {
        this.studentScore = 0;
        for (const assignedWorkshop of this.assignedWorkshops) {
            let unpreferred = true;
            for (let j = 0; j < this.preferences.length; j++) {
                const preference = this.preferences[j];
                if (assignedWorkshop === preference) {
                    this.studentScore += this.scorerPoints[j];
                    unpreferred = false;
                }
            }
            if (unpreferred) {
                this.studentScore += this.unpreferredScore;
            }
        }
        return this.studentScore;
    }
calculateScore ( ) { this . studentScore = 0 ; for ( const assignedWorkshop of this . assignedWorkshops ) { let unpreferred = true ; for ( let j = 0 ; j < this . preferences . length ; j ++ ) { const preference = this . preferences [ j ] ; if ( assignedWorkshop === preference ) { this . studentScore += this . scorerPoints [ j ] ; unpreferred = false ; } } if ( unpreferred ) { this . studentScore += this . unpreferredScore ; } } return this . studentScore ; }
Calculates and returns the "score" of this student's assigned workshops based on their preferences.
Calculates and returns the " score " of this student ' s assigned workshops based on their preferences .
// for each assigned workshop i // for each preferred workshop j