Reviewing assignments automatically
Define clear conditions for your task to ensure that you get the desired output. The conditions check that a Toloker did the required actions.
In Toloka, you can use conditions to automate the assignment review process. For example, a Toloker can't submit an assignment before they meet your required conditions.
Review features
-
What can be reviewed:
-
Where to specify conditions:
- In the
validation
property of the parent component. - In the
condition
property of plugin.trigger.
- In the
-
A link to the reviewed data is specified in the
data
property. -
Some components don't have the
data
property, and you can only access them from thevalidation
property of the parent component (for example, condition.played and condition.played-fully).
Making a field mandatory
To check that the data is filled in, add the condition.required component.
In this example, a Toloker must fill in the text field, otherwise the “Submit” button won't work. The condition.empty component works the opposite way: it checks if the data is empty and returns false
if the data has a value.
Comparing values
Checking that values are equal
To check that the preset value and output value are equal, use the component condition.equals.
In this example, if a Toloker responds “No”, a text entry field appears.
Checking that values are not equal
To return the values that don't meet the specified conditions, list them in the condition
property of the condition.not component.
In this example, if the condition.equals
condition is met and returns true
, condition.not
returns false
and hides the text entry field.
When there are multiple correct responses
To check that an array in data
is a subarray for parent
, add the component condition.sub-array.
In this example, the component checks that the values animal
and human
are part of the objects
array. If the responses “Human” and “Animal” are selected, the helper.if
logical component displays the question: “Do the human and animal interact?”.
Checking multiple conditions
Meeting all conditions
To check that multiple conditions are met, list them in the condition
property of the condition.all component.
In this example, a Toloker has to do two actions: to fill in the text field and to click the link in the interface. The “Submit” button won't work until both conditions are met.
Meeting at least one of the conditions
To check that at least one of the conditions is met, list the conditions in the condition
property of the condition.any component.
In this example, a Toloker has to perform at least one of the two actions: to select “Nothing is written there” or to fill in the “What is written on the image?” field. The “Submit” button won't work until one of the conditions is met.
Checking conditions for specific components
Some conditions work only with certain components. For example, condition.link-opened works only with view.link
.
In this example, a Toloker has to click the link in the interface, otherwise the “Submit” button won't work.
Can't find the desired component?
In the list of conditions, you can see all the available components with the name conditions.*
. If you can't find the desired component in the list or want to use a preset configuration, define a review in the JSON Schema format using condition.schema.