0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

improved the logic to accomodate multiple conditions using 'or'

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-04-22 23:50:26 +05:30
Ursprung ceef3f4bc9
Commit 911140fde3

Datei anzeigen

@ -45,8 +45,9 @@ class CustomWizard::Mapper
def perform def perform
multiple = @opts[:multiple] multiple = @opts[:multiple]
perform_result = multiple ? [] : nil perform_result = multiple ? [] : nil
input_size = inputs.size
inputs.each do |input| inputs.each_with_index do |input, index|
input_type = input['type'] input_type = input['type']
pairs = input['pairs'] pairs = input['pairs']
@ -69,6 +70,8 @@ class CustomWizard::Mapper
if multiple if multiple
perform_result.push(result) perform_result.push(result)
elsif result != true && index < (input_size - 1)
next
else else
perform_result = result perform_result = result
break break