Fix duplicate branch in Spree::Preference#value method

:string, :text and :password cases have the same value
This commit is contained in:
Ana Nunes da Silva
2024-03-28 19:48:59 +00:00
parent 3e796da8ff
commit 5fde1cc7cd
2 changed files with 2 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ Lint/DuplicateBranch:
# - 'app/helpers/spree/admin/base_helper.rb'
# - 'app/models/enterprise.rb'
# - 'app/models/spree/calculator.rb'
- 'app/models/spree/preference.rb'
# - 'app/models/spree/preference.rb'
- 'app/models/spree/preferences/preferable.rb'
# Offense count: 2

View File

@@ -16,9 +16,7 @@ module Spree
def value
if self[:value_type].present?
case self[:value_type].to_sym
when :string, :text
self[:value].to_s
when :password
when :string, :text, :password
self[:value].to_s
when :decimal
BigDecimal(self[:value].to_s, exception: false)&.round(2, BigDecimal::ROUND_HALF_UP) ||