mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-02 21:51:51 +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
|
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
|
||||||
|
|
Loading…
Reference in a new issue