mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
Fix in memory loading of storage location tree [SCI-10863]
This commit is contained in:
parent
2f53772f61
commit
d725e278c1
1 changed files with 4 additions and 10 deletions
|
@ -142,17 +142,11 @@ class StorageLocationsController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def storage_locations_recursive_builder(storage_location, records)
|
||||
children = records.select do |i|
|
||||
defined?(i.parent_id) && i.parent_id == storage_location&.id
|
||||
end
|
||||
|
||||
children.filter_map do |i|
|
||||
next if i.container
|
||||
|
||||
def storage_locations_recursive_builder(parent_storage_location, records)
|
||||
records.where(parent: parent_storage_location, container: false).map do |storage_location|
|
||||
{
|
||||
storage_location: i,
|
||||
children: storage_locations_recursive_builder(i, records)
|
||||
storage_location: storage_location,
|
||||
children: storage_locations_recursive_builder(storage_location, records)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue