<commit_before>package turkey.tasks

import scalajs.js
import scalajs.js.JSApp
import org.scalajs.jquery.jQuery
import org.scalajs.dom

import upickle.default._

/** Superclass for an implementation of a client/interface for a turk task.
  * Gives access by field to all of the information written into the `TaskPage` on the server.
  */
abstract class TaskClient[Prompt : Reader, Response : Writer] {
  import scala.scalajs.js.Dynamic.global

  lazy val assignmentId: String = {
    global.turkSetAssignmentID()
    jQuery("#assignmentId").attr("value").get
  }

  lazy val isNotAssigned = assignmentId == "ASSIGNMENT_ID_NOT_AVAILABLE"

  import FieldLabels._
<commit_msg>Add workerId to TaskClient fields<commit_after>package turkey.tasks

import scalajs.js
import scalajs.js.JSApp
import org.scalajs.jquery.jQuery
import org.scalajs.dom

import upickle.default._

/** Superclass for an implementation of a client/interface for a turk task.
  * Gives access by field to all of the information written into the `TaskPage` on the server.
  */
abstract class TaskClient[Prompt : Reader, Response : Writer] {
  import scala.scalajs.js.Dynamic.global

  lazy val assignmentIdOpt: Option[String] = {
    global.turkSetAssignmentID()
    jQuery("#assignmentId").attr("value").toOption.filter(_ != "ASSIGNMENT_ID_NOT_AVAILABLE")
  }

  lazy val isNotAssigned = assignmentIdOpt.isEmpty

  lazy val workerIdOpt: Option[String] = {
    Option(global.turkGetParam("workerId", "UNASSIGNED").asInstanceOf[String]).filter(_ != "UNASSIGNED")
  }

  import FieldLabels._

{'fraction_non_alphanumeric': 0.09640102827763496, 'fraction_numerical': 0.0, 'mean_word_length': 4.641304347826087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6267896', 'n_tokens_mistral': 492, 'n_tokens_neox': 484, 'n_words': 131}