-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds dialog field association info to importer #15740
Adds dialog field association info to importer #15740
Conversation
associations.each do |association| | ||
association.values.each do |values| | ||
values.each do |responder| | ||
unless new_or_existing_dialog.dialog_fields.select { |field| field.name == responder }.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a guard clause.
next if .....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping we could offload some of this to the database, but after further investigation I don't think that's possible right now.
dialog["dialog_tabs"].flat_map do |tab| | ||
tab["dialog_groups"].flat_map do |group| | ||
group["dialog_fields"].flat_map do |field| | ||
associations << { field["name"] => field["dialog_field_responders"] } unless field["dialog_field_responders"].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you're planning to add tests because it's hard to visualize this data structure looks like in my head.
ca52174
to
bcda199
Compare
allow(dialog_field_importer).to receive(:import_field).and_return(built_dialog_field) | ||
allow(dialog_field_importer).to receive(:import_field).and_return(built_dialog_field, built_dialog_field2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be a change to the previous line instead of an addition.
bcda199
to
eb0a6db
Compare
Checked commit d-m-u@eb0a6db with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
This creates dialog field associations from service dialogs during import. After creating the dialog fields, we set the associations, changing from storing them as names (strings) to storing them by newly created id as required by the new DialogFieldAssociation table.
Related to:
#15608
Depends on:
#15724
@miq-bot add_label enhancement
@miq-bot assign @gmcculloug