Improved code layout.

This commit is contained in:
Martin Edenhofer 2017-10-16 15:45:04 +02:00
parent 383eee4db9
commit 228a0df54a
3 changed files with 6 additions and 3 deletions

View file

@ -44,7 +44,7 @@ returns
overviews_list = [] overviews_list = []
overviews.each do |overview| overviews.each do |overview|
user_ids = overview.user_ids user_ids = overview.user_ids
next if !user_ids.empty? && !user_ids.include?(current_user.id) next if user_ids.present? && !user_ids.include?(current_user.id)
overviews_list.push overview overviews_list.push overview
end end
overviews_list overviews_list

View file

@ -58,6 +58,7 @@ returns
# get roles # get roles
if local_attributes['role_ids'] if local_attributes['role_ids']
local_attributes['role_ids'].each do |role_id| local_attributes['role_ids'].each do |role_id|
next if data[:Role] && data[:Role][role_id]
role = Role.lookup(id: role_id) role = Role.lookup(id: role_id)
data = role.assets(data) data = role.assets(data)
end end
@ -66,6 +67,7 @@ returns
# get groups # get groups
if local_attributes['group_ids'] if local_attributes['group_ids']
local_attributes['group_ids'].each do |group_id, _access| local_attributes['group_ids'].each do |group_id, _access|
next if data[:Group] && data[:Group][group_id]
group = Group.lookup(id: group_id) group = Group.lookup(id: group_id)
next if !group next if !group
data = group.assets(data) data = group.assets(data)
@ -75,6 +77,7 @@ returns
# get organizations # get organizations
if local_attributes['organization_ids'] if local_attributes['organization_ids']
local_attributes['organization_ids'].each do |organization_id| local_attributes['organization_ids'].each do |organization_id|
next if data[:Organization] && data[:Organization][organization_id]
organization = Organization.lookup(id: organization_id) organization = Organization.lookup(id: organization_id)
next if !organization next if !organization
data = organization.assets(data) data = organization.assets(data)
@ -86,7 +89,7 @@ returns
# add organization # add organization
if self.organization_id if self.organization_id
if !data[ Organization.to_app_model ] || !data[ Organization.to_app_model ][ self.organization_id ] if !data[:Organization] || !data[:Organization][self.organization_id]
organization = Organization.lookup(id: self.organization_id) organization = Organization.lookup(id: self.organization_id)
if organization if organization
data = organization.assets(data) data = organization.assets(data)

View file

@ -23,7 +23,7 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base
index_and_lists = Ticket::Overviews.index(@user) index_and_lists = Ticket::Overviews.index(@user)
# no data exists # no data exists
return if !index_and_lists || index_and_lists.empty? return if index_and_lists.blank?
# no change exists # no change exists
return if @last_change == index_and_lists return if @last_change == index_and_lists