<commit_before><div class="jumbotron">
    <p class="lead">
    <img src="images/logo.png" alt="<%=name%>"><br>
    </p>
</div>

<div class="row marketing">
  <p class="alert alert-warning">
    <strong>Aviso importante</strong>
    <br/>
    <%=disclaimer%>
  </p>
</div>

<%- sections.each.with_index do |section, i| -%>
<div class="row marketing" id="section-<%= code_suitable(section.name) %>">
  <label><%= section.name%></label>
  <ul>
  <%- section.questions.each.with_index do |question, j| -%>
    <li id="s<%=i%>-q<%=j%>">
      <p><%= question.text %></p>
      <div class="form-group" id="s<%=i%>-q<%=j%>-a">
      <%- if question.variables.length == 1 -%>
        <%- variable = question.variables.first -%>
        <div class="radio" id="s<%=i%>-q<%=j%>-a-yes">
          <label>
            <input type="radio" name="<%= code_suitable(variable.name) %>" data-ng-value="true" ng-model="answers.<%= code_suitable(variable.name) %>">
            <%= question.yes_text %>
          </label>
        </div>
        <div class="radio" id="s<%=i%>-q<%=j%>-a-no">
          <label>
            <input type="radio" name="<%= code_suitable(variable.name) %>" data-ng-value="false" ng-model="answers.<%= code_suitable(variable.name) %>">
              <%= question.no_text %>
          </label>
        </div>
      <%- else -%>
        <%- question.variables.each.with_index do |variable, k| -%>
        <label id="s<%=i%>-q<%=j%>-a<%=k%>">
          <input type="checkbox" ng-model="answers.<%= code_suitable(variable.name) %>"> <%= question.variable_text(variable) %>
        </label>
        <%- end -%>
      <%- end -%>
      </div>
    </li>
  <%- end -%>
  </ul>
</div>
<%- end -%>

<%- def boolean_expression_to_js(expression)
  case expression
  when Therapeutor::BooleanExpression::BooleanConstant then expression.value.to_s
  when Therapeutor::BooleanExpression::Variable then "answers.#{code_suitable(variable(expression.name).name)}"
  when Therapeutor::BooleanExpression::NotExpression then "!answers.#{code_suitable(variable(expression.operand.name).name)}"
  when Therapeutor::BooleanExpression::AndExpression then and_to_js(expression)
  when Therapeutor::BooleanExpression::OrExpression then or_to_js(expression)
  end
end
def and_to_js(expression)
  "(#{expression.operands.map do |operand|
    boolean_expression_to_js(operand)
  end.join(' && ')})"
end
def or_to_js(expression)
  expression.operands.map do |operand|
    boolean_expression_to_js(operand)
  end.join(' || ')
end
def color_to_alert_class(color)
  "alert-#{{<commit_msg>Turn radio answers into checkboxes<commit_after><div class="jumbotron">
    <p class="lead">
    <img src="images/logo.png" alt="<%=name%>"><br>
    </p>
</div>

<div class="row marketing">
  <p class="alert alert-warning">
    <strong>Aviso importante</strong>
    <br/>
    <%=disclaimer%>
  </p>
</div>

<%- sections.each.with_index do |section, i| -%>
<div class="row marketing" id="section-<%= code_suitable(section.name) %>">
  <label><%= section.name%></label>
  <ul>
  <%- section.questions.each.with_index do |question, j| -%>
    <li id="s<%=i%>-q<%=j%>">
      <p><%= question.text %></p>
      <div class="form-group" id="s<%=i%>-q<%=j%>-a">
      <%- if question.variables.length == 1 -%>
        <%- variable = question.variables.first -%>
        <input id="checkbox-s<%=i%>-q<%=j%>" type="checkbox" ng-model="answers.<%= code_suitable(variable.name) %>"> 
        <label for="checkbox-s<%=i%>-q<%=j%>">
          <%= question.yes_text %>
        </label>
      <%- else -%>
        <%- question.variables.each.with_index do |variable, k| -%>
        <input id="checkbox-s<%=i%>-q<%=j%>-a<%=k%>" type="checkbox" ng-model="answers.<%= code_suitable(variable.name) %>"> 
        <label for="checkbox-s<%=i%>-q<%=j%>-a<%=k%>">
          <%= question.variable_text(variable) %>
        </label>
        <%- end -%>
      <%- end -%>
      </div>
    </li>
  <%- end -%>
  </ul>
</div>
<%- end -%>

<%- def boolean_expression_to_js(expression)
  case expression
  when Therapeutor::BooleanExpression::BooleanConstant then expression.value.to_s
  when Therapeutor::BooleanExpression::Variable then "answers.#{code_suitable(variable(expression.name).name)}"
  when Therapeutor::BooleanExpression::NotExpression then "!answers.#{code_suitable(variable(expression.operand.name).name)}"
  when Therapeutor::BooleanExpression::AndExpression then and_to_js(expression)
  when Therapeutor::BooleanExpression::OrExpression then or_to_js(expression)
  end
end
def and_to_js(expression)
  "(#{expression.operands.map do |operand|
    boolean_expression_to_js(operand)
  end.join(' && ')})"
end
def or_to_js(expression)
  expression.operands.map do |operand|
    boolean_expression_to_js(operand)
  end.join(' || ')
end
def color_to_alert_class(color)
  "alert-#{{
{'fraction_non_alphanumeric': 0.20800497718788885, 'fraction_numerical': 0.00041476565740356696, 'mean_word_length': 3.633045148895293, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 0, '>': 139, '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': '950889', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1713, 'n_words': 273}