<commit_before>{% extends "base.html" %}

{% load static %}
{% load bootstrap3 %}

{% block header %}
<link rel="stylesheet" href="{% static 'kbpo/css/kbpo.css' %}">
<style>
span.type-marker{
    display:none;
}
span.link-marker {
    visibility:hidden;
}
div#relation-option-preview {
    height: auto;
}
</style>
{% endblock %}

{% block nav %}
{% if hidenav %}
{% else %}
  {{ block.super }}
{% endif %}
{% endblock %}

{% block content %}
<div class="row">
  <h1>Identify relationships between entities <small>Use the buttons at the bottom of the screen.</small></h1>
</div>
<div class="row">
  <form class ='input-group' id='mturk_form' action="{{mturk_form_target}}" method="POST">
  {% csrf_token %}
  <input type="hidden" name="assignmentId" value="{{assignment_id}}" />
  <input type="hidden" name="hitId" value="{{hit_id}}" />
  <input type="hidden" name="workerId" value="{{worker_id}}" />
  <input type="hidden" name="workerTime" id="workerTime" value="" />
  <input type="hidden" name="response" id="response" value="" />

  <input type="hidden" name="params" id="input-params" value="{{params}}" />
  <input type="hidden" name="duration" id="input-duration" value="{{duration}}" />
  <input type="hidden" name="reward"   id="input-reward"   value="{{reward}}" />

  <div class="col-md-8">
    <div class="row">
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="document short" id="document">
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="panel panel-default" id="relation-option-widget">
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div id="interface"></div>
  </div>
  </form>
</div>

<script src="/static/requirejs/require.js"></script>
<script>
  require.config({
    baseUrl: "/static/",
    paths: {
        "jquery": "jquery/dist/jquery",
        "bootstrap": "bootstrap/dist/js/bootstrap",
        "sprintf": "sprintf-js/dist/sprintf.min",
    },
  });
  require(["jquery",
      "kbpo/js/widgets/DocWidget",
      "kbpo/js/widgets/InstructionWidget",
      "kbpo/js/widgets/RelationInterface",
      ],
      function($, DocWidget, InstructionWidget, RelationInterface) {
        // THIS ONLY WORKS IN LATEST VERSIONS OF TASKS.
        var params = JSON.parse($("#input-params").val());
        var reward = parseFloat($("#input-reward").val());
        var duration = parseInt($("#input-duration").val());

        var docId = params["doc_id"];
        var verifyLinks = (params["batch_type"] === "selective_relations");

        var docWidget = new DocWidget($("#document"));<commit_msg>Minor fix to handle no input for reward or duration<commit_after>{% extends "base.html" %}

{% load static %}
{% load bootstrap3 %}

{% block header %}
<link rel="stylesheet" href="{% static 'kbpo/css/kbpo.css' %}">
<style>
span.type-marker{
    display:none;
}
span.link-marker {
    visibility:hidden;
}
div#relation-option-preview {
    height: auto;
}
</style>
{% endblock %}

{% block nav %}
{% if hidenav %}
{% else %}
  {{ block.super }}
{% endif %}
{% endblock %}

{% block content %}
<div class="row">
  <h1>Identify relationships between entities <small>Use the buttons at the bottom of the screen.</small></h1>
</div>
<div class="row">
  <form class ='input-group' id='mturk_form' action="{{mturk_form_target}}" method="POST">
  {% csrf_token %}
  <input type="hidden" name="assignmentId" value="{{assignment_id}}" />
  <input type="hidden" name="hitId" value="{{hit_id}}" />
  <input type="hidden" name="workerId" value="{{worker_id}}" />
  <input type="hidden" name="workerTime" id="workerTime" value="" />
  <input type="hidden" name="response" id="response" value="" />

  <input type="hidden" name="params" id="input-params" value="{{params}}" />
  <input type="hidden" name="duration" id="input-duration" value="{{duration}}" />
  <input type="hidden" name="reward"   id="input-reward"   value="{{reward}}" />

  <div class="col-md-8">
    <div class="row">
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="document short" id="document">
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="panel panel-default" id="relation-option-widget">
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div id="interface"></div>
  </div>
  </form>
</div>

<script src="/static/requirejs/require.js"></script>
<script>
  require.config({
    baseUrl: "/static/",
    paths: {
        "jquery": "jquery/dist/jquery",
        "bootstrap": "bootstrap/dist/js/bootstrap",
        "sprintf": "sprintf-js/dist/sprintf.min",
    },
  });
  require(["jquery",
      "kbpo/js/widgets/DocWidget",
      "kbpo/js/widgets/InstructionWidget",
      "kbpo/js/widgets/RelationInterface",
      ],
      function($, DocWidget, InstructionWidget, RelationInterface) {
        // THIS ONLY WORKS IN LATEST VERSIONS OF TASKS.
        var params = JSON.parse($("#input-params").val());
        var reward = parseFloat($("#input-reward").val());
        if (Number.isNaN(reward)) {
          reward = 0.0;
        }
        var duration = parseInt($("#input-duration").val());
        if (Number.isNaN(duration)) {
          duration = 0;
        }

        var docId = params["doc_id"];
        var verifyLinks = (params["batch_type"] === "selective_relations");

        var docWidget = new DocWidget($("#document"));
{'fraction_non_alphanumeric': 0.20173176123802505, 'fraction_numerical': 0.002394988946204864, 'mean_word_length': 3.381759483454399, 'pattern_counts': {'":': 6, '<': 87, '<?xml version=': 0, '>': 87, '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': '1356911', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1756, 'n_words': 372}