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 Yandex.Toloka, conditions let you automate the assignment review process. For example, the performer can't submit an assignment before they meet your required conditions.
- Where to specify conditions:
- In the
validationproperty of the parent component.
- In the
conditionproperty of plugin.trigger.
- A link to the reviewed data is specified in the
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.
- 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
conditionproperty of the condition.not component.
In this example, if the
condition.equalscondition is met and returns
falseand hides the text entry field.
- When there are multiple correct responses
To check that an array in
datais a subarray for
parent, add the component condition.sub-array.
In this example, the component checks that the values
humanare part of the
objectsarray. If the responses “Human” and “Animal” are selected, the
helper.iflogical 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
conditionproperty 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
conditionproperty 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
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.