Skip to content

Blocking user functionality

Davide Zanella edited this page Jun 2, 2019 · 2 revisions

The Blocking user functionality essentially checks, using some rules, given by the designer of a workflow, if a user can submit more job of the same workflow.

Context

The context is a sort of box which contains one or more do-blocks, a worker of a platform can submit only a job in a context. The contexts are defined in the workflow entity.

Worker ID

The id of the worker are retrieved or calculated in base of the platform. On Figure-eight we can retrieve the id of the worker from the html of the task. On Toloka we create a random number as an ID and then store it in the LocalStorage of the browser, next time we try to retrieve the id from there instead of recreating it.

The logic

When a user opens a task some custom JavaScript code is executed, this code:

  • gets or creates the worker ID
  • gets the job ID from the html of the page
  • send a POST request to the servant-api endpoint /worker-of-workflows specifying the worker ID, the job ID and the crowdsourcing platform
  • the endpoint returns:
    • 'OK' message if the user can work on that task, so the user has not already worked on another job in the same context. The user is stored in the workers_of_workflow table.
    • error message if the user is not allowed to submit an answer to that specific task. Even a custom error message specified by the designer of the workflow is returned. The error message is showed to the worker.

The unique constraint of the workers_of_workflow table implements itself the decision if a worker can submit an answer for a specified task.

Clone this wiki locally