Reviewing assignments automatically
Define clear conditions for your task to ensure that you get the desired output. The conditions check that the performer did the required actions.
In Toloka, conditions let you automate the assignment review process. For example, the performer can't submit an assignment before they meet your required conditions.
Review features
- Where to specify conditions:
- In the
validation
property of the parent component. - In the
condition
property of plugin.trigger.
- 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, the user 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 the user 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 returnstrue
,condition.not
returnsfalse
and hides the text entry field. - When there are multiple correct responses
-
To check that an array in
data
is a subarray forparent
, add the component condition.sub-array.In this example, the component checks that the values
animal
andhuman
are part of theobjects
array. If the responses “Human” and “Animal” are selected, thehelper.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, the uses has to do two actions: fill out the text field and 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, the user has to perform at least one of the two actions: select “Nothing is written there” or fill out 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, the user 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.