split screen size unit

This commit is contained in:
Barnabé 2021-10-19 19:00:48 +02:00
parent 0ebfb92f32
commit 4f799af47a

View File

@ -284,7 +284,6 @@ class PProduct < ApplicationRecord
row.each do |key, value| row.each do |key, value|
if value.present? if value.present?
puts key
case key case key
when "identifiant" when "identifiant"
ref.description = value if !value.blank? ref.description = value if !value.blank?
@ -328,13 +327,13 @@ class PProduct < ApplicationRecord
arr.each do |value| arr.each do |value|
spec = nil spec = nil
if cellular.include?(value) if cellular.include?(value)
spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Connectivité"), p_spec_value: PSpecValue.find_or_create_by!(value: value)) spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Connectivité"), p_spec_value: PSpecValue.find_or_create_by!(value: value))
elsif video.include?(value) elsif video.include?(value)
spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Résolution"), p_spec_value: PSpecValue.find_or_create_by!(value: value)) spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Résolution"), p_spec_value: PSpecValue.find_or_create_by!(value: value.to_s))
elsif power.include?(value) elsif power.include?(value)
PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Puissance éléctrique"), p_spec_value: PSpecValue.find_or_create_by!(value: value.gsub('W', ''), unit: "W")) PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Puissance éléctrique"), p_spec_value: PSpecValue.find_or_create_by!(value: value.gsub('W', ''), unit: "W"))
elsif geoloc.include?(value) elsif geoloc.include?(value)
spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Géolocalisation"), p_spec_value: PSpecValue.find_or_create_by!(value: value)) spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Géolocalisation"), p_spec_value: PSpecValue.find_or_create_by!(value: value))
else else
spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Autre"), p_spec_value: PSpecValue.find_or_create_by!(value: value)) spec = PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Autre"), p_spec_value: PSpecValue.find_or_create_by!(value: value))
end end
@ -349,7 +348,8 @@ class PProduct < ApplicationRecord
end end
when "taille" when "taille"
PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Taille"), p_spec_value: PSpecValue.find_or_create_by!(value: value.to_s)) float = value.to_s.match(/[^"\s]*/)
PProductRefSpec.create!(p_product_ref: ref, p_spec_type: PSpecType.find_by(name: "Taille"), p_spec_value: PSpecValue.find_or_create_by!(value: float.to_s, unit: '"'))
when "capacite" when "capacite"
unit = value.match(/\D+/) unit = value.match(/\D+/)