Basic formulas
With grading formulas you can set up a custom calculation for module and edition grades. When you write a formula, there are a few variables available. For a module these will correspond to the grades of the assignments. For an editions these will correspond to the grades of the modules.
You can apply several operations on those variables. Available operations are:
-
Multiplication, e.g.
assignment_1 * 2 -
Division, e.g.
assignment_1 / 2 -
Addition, e.g.
assignment_1 + assignment_2 -
Subtraction, e.g.
assignment_1 - 1 -
Exponentiation, e.g.
assignment_1 ^ 1.1 -
Modulo, this is the remainder of a division. For example
5 mod 2 = 1. An example use case of this is rounding a number down or up, e.g.assignment_1 - assignment_1 mod 10. If the score for 'assignment 1' is 54 in this case, the result will be 50.
Conditions
Sometimes, you might want to give a different score based on a condition. For
example, the students might have to get higher than a 6 for assignment 1, then
assignment 2 will be their final score, otherwise they get a 1.0. You can achieve
this using
if
:
assignment_2 if assignment_1 > 6.0 else 1.0
>
is one of the relational operators. There are several of those as well:
-
Greater than, e.g.
assignment_1 > 6.0 -
Less than, e.g.
assignment_1 < 1.0 -
Greater than or equal, .e.g
assignment_1 >= 6.0 -
Less than or equal, e.g.
assignment_1 <= 1.0 -
Equal, e.g.
assignment_1 = 10.0 -
Not equal, e.g.
assignment_1 != 1.0
You might want to check for multiple conditions. For example to check whether a
score is between some values, let's say 1 and 5. In that case you can use
and
, in which case both conditions need to be true. So:
5.0 if assignment_1 >= 1 and assignment_1 <= 5 else assignment_1
. The other thing you could do is check if either one condition is true, i.e. the
first condition, the second, or both. Then you can use
or
.
Functions
There are some functions available for you to use. These can be used to make some operations easier and more concise. These functions are:
-
avg: calculates the average of an arbitrary amount of numbers. Usage:avg(assignment_1, assignment_2, assignment_3) -
min: gets the lowest two numbers. Usage:min(assignment_1, 10.0) -
max: gets the highest of two numbers. Usage:max(assignment_1, 1.0) -
clamp: a combination of min and max, the middle number stays between the two outer numbers. Usage:clamp(1.0, assignment_1, 10.0) -
sqrt: calculates the square root of a number. Usage:sqrt(2.0) -
abs: calculates the absolute value of a number. Usage:abs(assignment_1)
Special values
You can use the special values
PASSED
and
FAILED
to check if the students passed an assignment. These correspond to the values
1.0
and
0.0
respectively. So writing
10.0 if assignment = PASSED else 1.0
is equivalent to
10.0 if assignment = 1.0 else 1.0
, but might be slightly more clear. You can also use these values to make the entire
module or edition pass/fail, in addition to setting the grade type to 'Pass / Fail'.
There are special versions of the assignment variables available as well: one for
checking if a score was created by a script and one for only human-made scores. You
can put
_isScript
or
_noScript
directly after the assignment name respectively. So as an example:
assignment_1 / 2.0 if assignment_1_isScript else assignment_1
awards the student half points if their score was script graded and full points if
it was human graded.
assignment_1_noScript
on the other hand, awards the student no points if their score was script graded.
Finally, two variables for calculating grades depending on when an assignment was
submitted or graded exist. Putting
_submissionTime
directly after the assignment name will give the submission time in hours relative
to the deadline. Putting
_gradeTime
directly after the assignment name will give the grading time in hours relative to
the deadline. This means that in most of the cases these numbers will be
negative
.