Fix in memory loading of storage location tree [SCI-10863]

This commit is contained in:
Andrej 2024-07-23 09:44:57 +02:00
parent 2f53772f61
commit d725e278c1

View file

@ -142,17 +142,11 @@ class StorageLocationsController < ApplicationController
} }
end end
def storage_locations_recursive_builder(storage_location, records) def storage_locations_recursive_builder(parent_storage_location, records)
children = records.select do |i| records.where(parent: parent_storage_location, container: false).map do |storage_location|
defined?(i.parent_id) && i.parent_id == storage_location&.id
end
children.filter_map do |i|
next if i.container
{ {
storage_location: i, storage_location: storage_location,
children: storage_locations_recursive_builder(i, records) children: storage_locations_recursive_builder(storage_location, records)
} }
end end
end end