Improved code layout for rubocop.

This commit is contained in:
Martin Edenhofer 2015-05-01 15:54:53 +02:00
parent a63e1bc1f9
commit 0e6fde30d0

View file

@ -538,6 +538,7 @@ module Import::OTRS2
updated_by_id: 1, updated_by_id: 1,
} }
map[:Ticket].each { |key, value| map[:Ticket].each { |key, value|
next if !record.key?(key.to_s)
ticket_new[value] = record[key.to_s] ticket_new[value] = record[key.to_s]
} }
ticket_old = Ticket.where( id: ticket_new[:id] ).first ticket_old = Ticket.where( id: ticket_new[:id] ).first
@ -597,6 +598,7 @@ module Import::OTRS2
} }
map[:Article].each { |key, value| map[:Article].each { |key, value|
next if !article.key?(key.to_s)
article_new[value] = article[key.to_s] article_new[value] = article[key.to_s]
} }
@ -789,9 +791,8 @@ module Import::OTRS2
updated_by_id: 1, updated_by_id: 1,
} }
map.each { |key, value| map.each { |key, value|
if state.key?(key.to_s) next if !state.key?(key.to_s)
state_new[value] = state[key.to_s] state_new[value] = state[key.to_s]
end
} }
# check if state already exists # check if state already exists
@ -838,9 +839,8 @@ module Import::OTRS2
updated_by_id: 1, updated_by_id: 1,
} }
map.each { |key, value| map.each { |key, value|
if priority.key?(key.to_s) next if !priority.key?(key.to_s)
priority_new[value] = priority[key.to_s] priority_new[value] = priority[key.to_s]
end
} }
# check if state already exists # check if state already exists
@ -879,9 +879,8 @@ module Import::OTRS2
updated_by_id: 1, updated_by_id: 1,
} }
map.each { |key, value| map.each { |key, value|
if group.key?(key.to_s) next if !group.key?(key.to_s)
group_new[value] = group[key.to_s] group_new[value] = group[key.to_s]
end
} }
# check if state already exists # check if state already exists
@ -934,9 +933,8 @@ module Import::OTRS2
group_ids: group_ids, group_ids: group_ids,
} }
map.each { |key, value| map.each { |key, value|
if user.key?(key.to_s) next if !user.key?(key.to_s)
user_new[value] = user[key.to_s] user_new[value] = user[key.to_s]
end
} }
# set pw # set pw
@ -1012,9 +1010,8 @@ module Import::OTRS2
} }
roles.each {|role| roles.each {|role|
role_lookup = Role.lookup( name: role ) role_lookup = Role.lookup( name: role )
if role_lookup next if !role_lookup
role_ids.push role_lookup.id role_ids.push role_lookup.id
end
} }
role_ids role_ids
end end
@ -1058,9 +1055,8 @@ module Import::OTRS2
role_ids: [ role_customer.id ], role_ids: [ role_customer.id ],
} }
map.each { |key, value| map.each { |key, value|
if user.key?(key.to_s) next if !user.key?(key.to_s)
user_new[value] = user[key.to_s] user_new[value] = user[key.to_s]
end
} }
# check if customer already exists # check if customer already exists
@ -1091,10 +1087,9 @@ module Import::OTRS2
organization_id = nil organization_id = nil
if user['UserCustomerID'] if user['UserCustomerID']
organizations.each {|organization| organizations.each {|organization|
if user['UserCustomerID'] == organization['CustomerID'] next if user['UserCustomerID'] != organization['CustomerID']
organization = Organization.where(name: organization['CustomerCompanyName'] ).first organization = Organization.where(name: organization['CustomerCompanyName'] ).first
organization_id = organization.id organization_id = organization.id
end
} }
end end
organization_id organization_id
@ -1121,9 +1116,8 @@ module Import::OTRS2
updated_by_id: 1, updated_by_id: 1,
} }
map.each { |key, value| map.each { |key, value|
if organization.key?(key.to_s) next if !organization.key?(key.to_s)
organization_new[value] = organization[key.to_s] organization_new[value] = organization[key.to_s]
end
} }
# check if state already exists # check if state already exists
@ -1185,7 +1179,6 @@ module Import::OTRS2
if setting['Key'] == 'Ticket::Hook' if setting['Key'] == 'Ticket::Hook'
Setting.set( 'ticket_hook', setting['Value'] ) Setting.set( 'ticket_hook', setting['Value'] )
end end
} }
end end