<commit_before>module Spree
  class CalcTiresController < BaseController
    def calc_equivalents
      @equivalentes = []
      ancho = Spree::TireWidth.find(params[:width]).name
      perfil = Spree::TireSerial.find(params[:serial]).name
      llanta = Spree::TireInnertube.find(params[:innertube]).name
      @diametro = calculo_diametro(ancho, perfil, llanta)
      minimum = @diametro * 0.97
      maximum = @diametro * 1.03
      ta = Spree::TireWidth.in_mm(true).map {|c| c.name}
      tp = Spree::TireSerial.in_mm(true).map {|c| c.name}
      tl = Spree::TireInnertube.in_mm(true).map {|c| c.name}
      ta.each do |width|
        tp.each do |serial|
          tl.each do |innertube|
            parcial = calculo_diametro(width, serial, innertube)
            if (parcial <= maximum) && (parcial >= minimum)
              neumatico = ta + "/" + tp + "R" + tl
              @equivalentes << [neumatico, neumatico]
            end
          end
        end
      end


      respond_to do |format|
        format.js
      end
    end

    private

    def calculo_diametro(ancho, perfil, llanta)
      ((((ancho.to_f / 25.4) * (perfil.to_f/100) * 2) + llanta.to_f) * 25.4).round(2)<commit_msg>mas mejoras<commit_after>module Spree
  class CalcTiresController < BaseController
    def calc_equivalents
      @equivalentes = []
      ancho = Spree::TireWidth.find(params[:width]).name
      perfil = Spree::TireSerial.find(params[:serial]).name
      llanta = Spree::TireInnertube.find(params[:innertube]).name
      @diametro = calculo_diametro(ancho, perfil, llanta)
      minimum = @diametro * 0.97
      maximum = @diametro * 1.03
      ta = Spree::TireWidth.in_mm(true).map {|c| c.name}
      tp = Spree::TireSerial.in_mm(true).map {|c| c.name}
      tl = Spree::TireInnertube.in_mm(true).map {|c| c.name}
      ta.each do |width|
        tp.each do |serial|
          tl.each do |innertube|
            parcial = calculo_diametro(width, serial, innertube)
            if (parcial <= maximum) && (parcial >= minimum)
              neumatico = width + "/" + serial + "R" + innertube
              @equivalentes << [neumatico, neumatico]
            end
          end
        end
      end


      respond_to do |format|
        format.js
      end
    end

    private

    def calculo_diametro(ancho, perfil, llanta)
      ((((ancho.to_f / 25.4) * (perfil.to_f/100) * 2) + llanta.to_f) * 25.4).round(2)
{'fraction_non_alphanumeric': 0.1318407960199005, 'fraction_numerical': 0.014096185737976783, 'mean_word_length': 2.3236914600550964, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '5003386', 'n_tokens_mistral': 910, 'n_tokens_neox': 867, 'n_words': 166}