1
0

Display readout list in tree format

This commit is contained in:
cryptogopher
2021-05-12 21:34:00 +02:00
parent bb43370329
commit 96d1c40cb8
9 changed files with 51 additions and 60 deletions

View File

@@ -27,5 +27,13 @@ class ReadoutsController < ApplicationController
@measurements, @filter_q = @routine.measurements.includes(:routine, :source)
.filter(session[:m_filters], @quantities)
# 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)
end
end
end
end