1
0

Fix readout quantity tree display

This commit is contained in:
cryptogopher 2021-05-19 22:39:04 +02:00
parent 96d1c40cb8
commit 745e1f4264

View File

@ -31,8 +31,8 @@ class ReadoutsController < ApplicationController
# Keep only non-nil readouts and their ancestors
@measurements.each do |measurement, readouts|
ancestors = {}
readouts.keep_if do |q, readout|
(readout || ancestors[q]) && (ancestors[q.parent] = true)
readouts.keys.sort_by(&:depth).reverse_each do |q|
readouts[q] || ancestors[q] ? ancestors[q.parent] = true : readouts.delete(q)
end
end
end