<commit_before><% if @product.has_variants? %>
  <div id="product-variants">
    <h2><%= t('variants') %></h2>
        
    <% index = 0 %>
    <% @product.grouped_option_values.each do |type, values| %>
      <div id="<%= dom_id(type) %>" class="variant-options index-<%= index %>">
        <h6 class="variant-option-type"><%= type.presentation %></h6>
        <ul class="variant-option-values">
        <% values.each do |value| %>
          <% classes = ["option-value"] %>
          <% if index == 0 %>
            <% variants = @variants.select{|i| i.option_values.select{|j| j.option_type_id == type.id && j == value }.length == 1 } %>
            <% if variants.empty? %>
              <% classes << "unavailable" %>
            <% else %>
              <% classes << ( Spree::Config[:allow_backorders] || variants.sum(&:count_on_hand) > 0 ? "in-stock" : "out-of-stock" ) %>
            <% end %>
          <% end %>
          <li>
            <%= link_to value.has_image? ? image_tag(value.image.url, :alt => value.presentation) : content_tag(:span, value.presentation), "#", :title => value.presentation, :class => classes.join(" "), :rel => "#{type.id}-#{value.id}" %>
          </li>
        <% end %>
          <li class="clear-option"><%= link_to "X", "#clear", :class => "clear-button clear-index-#{index}" %></li>
          <li class="clear"></li>
        </ul>
      </div>
      <% index += 1 %>
    <% end %>
    <%= hidden_field_tag "products[#{@product.id}]", "", :id => "variant_id", :class => "hidden" %>
    <script type="text/javascript">
    //<![CDATA[
        var variant_options = new VariantOptions(<%== @product.variant_options_hash.to_json %>, <%==  Spree::Config[:allow_backorders] %>);
    //]]>
    </script>
    
  </div>

<% end%><commit_msg>Forcing allow_backorders to a boolean<commit_after><% if @product.has_variants? %>
  <div id="product-variants">
    <h2><%= t('variants') %></h2>
        
    <% index = 0 %>
    <% @product.grouped_option_values.each do |type, values| %>
      <div id="<%= dom_id(type) %>" class="variant-options index-<%= index %>">
        <h6 class="variant-option-type"><%= type.presentation %></h6>
        <ul class="variant-option-values">
        <% values.each do |value| %>
          <% classes = ["option-value"] %>
          <% if index == 0 %>
            <% variants = @variants.select{|i| i.option_values.select{|j| j.option_type_id == type.id && j == value }.length == 1 } %>
            <% if variants.empty? %>
              <% classes << "unavailable" %>
            <% else %>
              <% classes << ( Spree::Config[:allow_backorders] || variants.sum(&:count_on_hand) > 0 ? "in-stock" : "out-of-stock" ) %>
            <% end %>
          <% end %>
          <li>
            <%= link_to value.has_image? ? image_tag(value.image.url, :alt => value.presentation) : content_tag(:span, value.presentation), "#", :title => value.presentation, :class => classes.join(" "), :rel => "#{type.id}-#{value.id}" %>
          </li>
        <% end %>
          <li class="clear-option"><%= link_to "X", "#clear", :class => "clear-button clear-index-#{index}" %></li>
          <li class="clear"></li>
        </ul>
      </div>
      <% index += 1 %>
    <% end %>
    <%= hidden_field_tag "products[#{@product.id}]", "", :id => "variant_id", :class => "hidden" %>
    <script type="text/javascript">
    //<![CDATA[
        var variant_options = new VariantOptions(<%== @product.variant_options_hash.to_json %>, <%==  !!Spree::Config[:allow_backorders] %>);
    //]]>
    </script>
    
  </div>

<% end%>
{'fraction_non_alphanumeric': 0.22333891680625348, 'fraction_numerical': 0.005025125628140704, 'mean_word_length': 2.475266731328807, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 109, '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': '7053031', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1158, 'n_words': 215}