<commit_before><% choices = {} %>


<div class="row">
  <div class="span12 main">
    <div class="grouptitle">Philadelphia2035 June Pilot &rsaquo;</div>
    <p id="notice"><%= notice %></p>
  </div>
</div>

<div class="row">
  <div class="span6">
    <ol>
      <% @poll.questions.each do |q| %>
        <li><span class="qtext"><%= q.text %></span> <span class="qtype">(<%= q.question_type %>)</span></li>
        <% unless q.options.empty? %>
          <ul>
            <% q.options.each do |o| %>
              <li><span class="optionvalue"><%= o.value %>:</span> <%= o.text %></li>
              <% o.follow_up.each do |fup| %>
                <ul>
                  <li><span class="qtext"><%= fup.text %></span> <span class="qtype">(<%= fup.question_type %>)</span></li>
                  <% unless fup.options.empty? %>
                    <ul>
                      <% fup.options.each do |o| %>
                        <li><%= o.value %> = <%= o.text %></li>
                      <% end %>
                    </ul>
                  <% end %>
                </ul>
              <% end %>
            <% end %>
          </ul>
        <% end %>
      <% end %>
    </ol>
    <div class="summaryviz">
      <span class='summarysectiontitle'>Frequently mentioned words</span><br>
      <%= html_histogram(@poll.response_histogram)%>
    </div>
  </div>


  <div class="span3">
    <div class="counterdash">
      <div class="responsecount"><%= @poll.responses.count %></div>
      <br>
      <span class="caption">responses</span>
      <br>
      <!--img src="http://chart.apis.google.com/chart?chf=a,s,000000&chs=100x40&cht=ls&chd=s:degddgjmqxuurruxwrro&chls=1&chf=bg,s,65432100" width="100" height="40" alt="" /-->
      <%= sparkline @poll.time_series %>
      <br>
      <span class="caption">latest about <%= format_time@poll.time_since_last_response %> ago</span>
    </div>
  </div>

  <div class="span3">
    <div class="settings">
      <div class="caption">Assigned phone</div>
      <div class="settingstext"><%= number_to_phone(@poll.phone, :area_code => true)[1..-1] %></div>

      <div class="caption">Assigned phone</div>
      <div class="settingstext"><%= number_to_phone(@poll.phone, :area_code => true) %></div>

      <div class="caption">Start date</div>
      <div class="settingstext"><%= @poll.start_date.strftime("%m/%d/%Y at %I:%M%p") %></div>

      <div class="caption">Status</div>
      <div class="settingstext"><%= @poll.running? ? 'Running' : 'Ended' %></div>


      <div class="btngroup">
        <!--<input type="button" class="btn btn-danger" value="Close poll">-->
        <% if @poll.running? %>
          <%= link_to 'End poll', end_poll_path(@poll), :class => "btn btn-danger", :confirm => 'Are you sure?', :method => :put %>
        <% end %>
        <%= link_to 'Edit', edit_poll_path(@poll), :class => "btn" %>
        &nbsp;<%= link_to 'Trash', @poll, confirm: 'Are you sure?', method: :delete %>
      </div>

    </div>
  </div>
</div>

<div class="row">
  <div class="span12 horiz"></div>
</div>

<div class="row">
  <div class="span12">
    <div class="download">
      <%= link_to "→ Download CSV", request.parameters.merge({:format => :csv})%>
    </div>
    <h3>Responses</h3>

    <table class="table">
      <tr>
        <th>
          <th>Timestamp</th>
          <% @poll.responses_flat.each_with_index do |resp, i| %>
            <tr>
              <td><%= i+1 %></td>
              <td><%= resp[:first_response_created].strftime("%m/%d/%Y at %I:%M%p")%></td>
              <% @poll.questions_all.each do |q| %>
                <td><%= resp[:texts][q.id] %></td>
              <% end %>
              <td><%= number_to_phone(resp[:from], :area_code => true)[1..-1] %></td>
            </tr>
          <% end %>
        </table>
      </div>
    </div><commit_msg>poll show resposects sequence (ordering) and fixed table headers from merge<commit_after><% choices = {} %>


<div class="row">
  <div class="span12 main">
    <div class="grouptitle">Philadelphia2035 June Pilot &rsaquo;</div>
    <p id="notice"><%= notice %></p>
  </div>
</div>

<div class="row">
  <div class="span6">
    <ol>
      <% @poll.questions_ordered.each do |q| %>
        <li><span class="qtext"><%= q.text %></span> <span class="qtype">(<%= q.question_type %>)</span></li>
        <% unless q.options.empty? %>
          <ul>
            <% q.options.each do |o| %>
              <li><span class="optionvalue"><%= o.value %>:</span> <%= o.text %></li>
              <% o.follow_up.each do |fup| %>
                <ul>
                  <li><span class="qtext"><%= fup.text %></span> <span class="qtype">(<%= fup.question_type %>)</span></li>
                  <% unless fup.options.empty? %>
                    <ul>
                      <% fup.options.each do |o| %>
                        <li><%= o.value %> = <%= o.text %></li>
                      <% end %>
                    </ul>
                  <% end %>
                </ul>
              <% end %>
            <% end %>
          </ul>
        <% end %>
      <% end %>
    </ol>
    <div class="summaryviz">
      <span class='summarysectiontitle'>Frequently mentioned words</span><br>
      <%= html_histogram(@poll.response_histogram)%>
    </div>
  </div>


  <div class="span3">
    <div class="counterdash">
      <div class="responsecount"><%= @poll.responses.count %></div>
      <br>
      <span class="caption">responses</span>
      <br>
      <!--img src="http://chart.apis.google.com/chart?chf=a,s,000000&chs=100x40&cht=ls&chd=s:degddgjmqxuurruxwrro&chls=1&chf=bg,s,65432100" width="100" height="40" alt="" /-->
      <%= sparkline @poll.time_series %>
      <br>
      <span class="caption">latest about <%= format_time@poll.time_since_last_response %> ago</span>
    </div>
  </div>

  <div class="span3">
    <div class="settings">
      <div class="caption">Assigned phone</div>
      <div class="settingstext"><%= number_to_phone(@poll.phone, :area_code => true)[1..-1] %></div>

      <div class="caption">Assigned phone</div>
      <div class="settingstext"><%= number_to_phone(@poll.phone, :area_code => true) %></div>

      <div class="caption">Start date</div>
      <div class="settingstext"><%= @poll.start_date.strftime("%m/%d/%Y at %I:%M%p") %></div>

      <div class="caption">Status</div>
      <div class="settingstext"><%= @poll.running? ? 'Running' : 'Ended' %></div>


      <div class="btngroup">
        <!--<input type="button" class="btn btn-danger" value="Close poll">-->
        <% if @poll.running? %>
          <%= link_to 'End poll', end_poll_path(@poll), :class => "btn btn-danger", :confirm => 'Are you sure?', :method => :put %>
        <% end %>
        <%= link_to 'Edit', edit_poll_path(@poll), :class => "btn" %>
        &nbsp;<%= link_to 'Trash', @poll, confirm: 'Are you sure?', method: :delete %>
      </div>

    </div>
  </div>
</div>

<div class="row">
  <div class="span12 horiz"></div>
</div>

<div class="row">
  <div class="span12">
    <div class="download">
      <%= link_to "→ Download CSV", request.parameters.merge({:format => :csv})%>
    </div>
    <h3>Responses</h3>
    <table class="table">
      <tr>
        <th>
          <th>Timestamp</th>
          <% @poll.questions_all.each do |q| %>
            <th><%= q.text %></th>
          <% end %>
          <th>Phone number</th>
        </tr>
        <% @poll.responses_flat.each_with_index do |resp, i| %>
          <tr>
            <td><%= i+1 %></td>
            <td><%= resp[:first_response_created].strftime("%m/%d/%Y at %I:%M%p")%></td>
            <% @poll.questions_all.each do |q| %>
              <td><%= resp[:texts][q.id] %></td>
            <% end %>
            <td><%= number_to_phone(resp[:from], :area_code => true) %></td>
          </tr>
        <% end %>
      </table>
    </div>
{'fraction_non_alphanumeric': 0.22026544155181216, 'fraction_numerical': 0.011230219499744768, 'mean_word_length': 2.2424493173355398, 'pattern_counts': {'":': 0, '<': 316, '<?xml version=': 0, '>': 332, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '899411', 'n_tokens_mistral': 2903, 'n_tokens_neox': 2637, 'n_words': 518}