Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
Pair validation should be cumulative
Dieser Commit ist enthalten in:
Ursprung
082be35199
Commit
07d0cbb0b4
1 geänderte Dateien mit 3 neuen und 7 gelöschten Zeilen
|
@ -84,9 +84,7 @@ class CustomWizard::Mapper
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_pairs(pairs)
|
def validate_pairs(pairs)
|
||||||
failed = false
|
pairs.all? do |pair|
|
||||||
|
|
||||||
pairs.each do |pair|
|
|
||||||
key = map_field(pair['key'], pair['key_type'])
|
key = map_field(pair['key'], pair['key_type'])
|
||||||
connector = pair['connector']
|
connector = pair['connector']
|
||||||
operator = map_operator(connector)
|
operator = map_operator(connector)
|
||||||
|
@ -97,13 +95,11 @@ class CustomWizard::Mapper
|
||||||
)
|
)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
failed = !cast_result(key.public_send(operator, value), connector)
|
cast_result(key.public_send(operator, value), connector)
|
||||||
rescue NoMethodError
|
rescue NoMethodError
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
!failed
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cast_value(key, value, connector)
|
def cast_value(key, value, connector)
|
||||||
|
|
Laden …
In neuem Issue referenzieren