Evaluation of the number of attempts

Last modified by Anna Paul-Hasenfuss on 26.02.2024

Expert rules let you evaluate the number of attempts of an assessable course element and thus control the visibility and access to other course sections. To do this, use the expert rule getAttempts. For each course element type, the return value of this expert rule shows the following value:

  • Course elements of the type Test, Self-test, and Survey: the number of started attempts.
  • Course elements of the type Task: the number of submitted files.
  • Course element Portfolio Task: the number of submitted Portfolio Tasks.

Another possibility is to transfer the number of attempts to an Onyx test. For more information, see the section Variables on the course element test.

All of the following example rules can be created for both the visibility and access of a course element. To simplify matters, only one scenario is described in each of the following examples. To learn more about the difference between visibility and access, see the page Publishing within courses (visibility and access).

In all of the following examples, specific course elements are used. Before using these rules, note down the course element IDs of the relevant course elements for your scenario and adjust them accordingly in the expert rules.

Syntax in General

Example of an expert rule

Result of this rule

getAttempts("[integer]")

getAttempts("70323786958847") > 0

The course element becomes visible as soon as the respective course participant has started the course element test (course element ID "70323786958847") for the first time.

getAttempts("70323524635734") <= 3

If used in the visibility tab, participants should no longer be able to see a course element as soon as they have placed more than 3 files in the drop box of a course element task (course element ID "70323524635734").

Create additional rules by using expert syntax. A tabular overview is provided on the page Expert syntax.