Skip to content
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

Merged
merged 1 commit into from
Aug 15, 2017

Conversation

d-m-u
Copy link
Contributor

@d-m-u d-m-u commented Aug 5, 2017

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

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?
Copy link
Member

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 .....

Copy link
Member

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?
Copy link
Member

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.

@d-m-u d-m-u force-pushed the adding_associations_to_import branch 2 times, most recently from ca52174 to bcda199 Compare August 10, 2017 12:08
@d-m-u d-m-u changed the title [WIP] Adds dialog field association info to importer Adds dialog field association info to importer Aug 10, 2017
@miq-bot miq-bot removed the wip label Aug 10, 2017
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)
Copy link
Member

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.

@d-m-u d-m-u force-pushed the adding_associations_to_import branch from bcda199 to eb0a6db Compare August 10, 2017 15:11
@miq-bot
Copy link
Member

miq-bot commented Aug 10, 2017

Checked commit d-m-u@eb0a6db with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@gmcculloug gmcculloug merged commit aad4439 into ManageIQ:master Aug 15, 2017
@gmcculloug gmcculloug added this to the Sprint 67 Ending Aug 21, 2017 milestone Aug 15, 2017
@d-m-u d-m-u deleted the adding_associations_to_import branch October 25, 2018 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants