<commit_before><div id="legend" style="text-align:right;">
  <% pins_for_legend.each do |pin| %>
  <span><img src="<%= pin[:icon] %>"/> <%= pin[:name] %></span>
  <% end %>
</div>

<div class="map-container">
  <div class="map-canvas" id="sidebar_builder"></div>
</div>
<br/>

<div>
  <%= form_tag(controller: "listings", action: "create") do %>
  <%= label_tag(:navicamls_url, "Add more homes from a NavicaMLS URL") %>
  <%= text_field_tag(:navicamls_url) %>
  <%= submit_tag("Add Homes") %>
  <% end %>
</div>


<div id='sidebar_container'>
  <h1>Houses [ <%= Listing.count %> ]</h1>
</div>


<script>
  function createSidebarLi(json){
    return ("<li><a>" + json.marker_title + "</a></li>");
  };

  function createSidebarTitle(status){
    return ("<h3>" + status + "</h3>");
  }

  function bindLiToMarker($li, marker){
    $li.on('click', function(){
      handler.getMap().setZoom(14);
      marker.setMap(handler.getMap()); //because clusterer removes map property from marker
      marker.panTo();
      google.maps.event.trigger(marker.getServiceObject(), 'click');
    })
  };

  function createSidebar(json_array){
    _.each(json_array, function(listings_json, status){
      var $title = $( createSidebarTitle(status) );
      $title.appendTo('#sidebar_container');
      _.each(listings_json, function(json){
        var $li = $( createSidebarLi(json) );
        $li.appendTo('#sidebar_container');
        bindLiToMarker($li, json.marker);
      });
    });
  };

  handler = Gmaps.build('Google');
  handler.buildMap({ internal: {id: 'sidebar_builder'}}, function(){
    var json_array = <%= raw @listings_map_hash.to_json %>;
    var listings_array = <%= raw @listings_map_hash.map { |k,v| v }.flatten.to_json %>;

    var markers = handler.addMarkers(listings_array);

    _.each(json_array, function(listings_json, status){
      _.each(listings_json, function(json, index){
        json.marker = markers[index];
      });
    });

    createSidebar(json_array);
    handler.bounds.extendWith(markers);
    handler.fitMapToBounds();
  });
</script><commit_msg>increment independent of json_array loop<commit_after><div id="legend" style="text-align:right;">
  <% pins_for_legend.each do |pin| %>
  <span><img src="<%= pin[:icon] %>"/> <%= pin[:name] %></span>
  <% end %>
</div>

<div class="map-container">
  <div class="map-canvas" id="sidebar_builder"></div>
</div>
<br/>

<div>
  <%= form_tag(controller: "listings", action: "create") do %>
  <%= label_tag(:navicamls_url, "Add more homes from a NavicaMLS URL") %>
  <%= text_field_tag(:navicamls_url) %>
  <%= submit_tag("Add Homes") %>
  <% end %>
</div>


<div id='sidebar_container'>
  <h1>Houses [ <%= Listing.count %> ]</h1>
</div>


<script>
  function createSidebarLi(json){
    return ("<li><a>" + json.marker_title + "</a></li>");
  };

  function createSidebarTitle(status){
    return ("<h3>" + status + "</h3>");
  }

  function bindLiToMarker($li, marker){
    $li.on('click', function(){
      handler.getMap().setZoom(14);
      marker.setMap(handler.getMap()); //because clusterer removes map property from marker
      marker.panTo();
      google.maps.event.trigger(marker.getServiceObject(), 'click');
    })
  };

  function createSidebar(json_array){
    _.each(json_array, function(listings_json, status){
      var $title = $( createSidebarTitle(status) );
      $title.appendTo('#sidebar_container');
      _.each(listings_json, function(json){
        var $li = $( createSidebarLi(json) );
        $li.appendTo('#sidebar_container');
        bindLiToMarker($li, json.marker);
      });
    });
  };

  handler = Gmaps.build('Google');
  handler.buildMap({ internal: {id: 'sidebar_builder'}}, function(){
    var json_array = <%= raw @listings_map_hash.to_json %>;
    var listings_array = <%= raw @listings_map_hash.map { |k,v| v }.flatten.to_json %>;

    var markers = handler.addMarkers(listings_array);

    var incrementer = 0;
    _.each(json_array, function(listings_json, status){
      _.each(listings_json, function(json, index){
        json.marker = markers[incrementer];
        incrementer++;
      });
    });

    createSidebar(json_array);
    handler.bounds.extendWith(markers);
    handler.fitMapToBounds();
  });
</script>
{'fraction_non_alphanumeric': 0.1906669809097337, 'fraction_numerical': 0.003063869903370257, 'mean_word_length': 3.86697247706422, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, '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': '4648067', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1426, 'n_words': 257}