mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Fix duplicate branch in Spree::Preference#value method
:string, :text and :password cases have the same value
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) ||
|
||||
|
||||
Reference in New Issue
Block a user