## Tools for CSE courses

### Using formulas

The final grade can be calculated from assignment weights (see Creating a new assignment) or by formula.

To calculate by formula, add an entry to file factory.

An entry consists of two fields:

- The first is the formula name (with an optional trailing colon). A leading asterix indicates that the formula is compulsory. See Final grades
- The second is a ruby formula whose variables are assignment names and formula names. If assignments are weighted, the special variable targil can also be used. The special variables
^{*}num_grades, num_exempt and num_exs and exempt can also be used. If there is an exam, formula final (and only formula final) should also use variable exam.

The value calculated by a formula can be overridden for particular students by creating file <formula name>.override, e.g. final1.override, with entries for just those students.

**num_grades - Number of non-exam items with grade or exempt; num_exempt - Number of exempt items; num_exs - Number of non-exam items with grade or exempt**

^{*}Special variables:__whose name begins with__

*ex*### Notes

- Of course, a formula can use only formula names that have been defined in earlier entries
- Formula final, if it exists, must be the last entry
- The special functions avg, max and avgmax are available. avg and max take no arguments and avgmax's single argument is the number of scores to average over
- num_grades is the number of non-exam grades (including exempts); num_exs is the number of grades for assignments
whose name begins with ex followed by a digit (including exempts); and num_exempt is the number of exempts
- The following variable name is reserved and should not be used: grade

### Examples

final: 0.2 * ![ex1, ex2, ex3, ex4].avgmax(3) + 0.8 * exam

ex123: (ex1 + ex2 + ex3) / 3 final: magen = ![ex123, ex4, exam].max; (37.5 * ex123 + 2.5 * ex2 + 50 * exam + 10 * magen) / 100

final: num_exs < 5 ? nil : ![ex1,ex2,ex3,ex4,ex5,ex6].avg

HUJI Moodle is a service of the **System group** of the School of Computer Science & Engineering

Design, development, deployment and documentation by Chana Slutzkin