Commit 7ac5389a by John Doe

bug fix for computing decimation intervals

parent 90950d07
Showing with 11 additions and 7 deletions
...@@ -202,14 +202,18 @@ class LoadStreamData ...@@ -202,14 +202,18 @@ class LoadStreamData
# eg: events, compute intervals from the actual decimated data # eg: events, compute intervals from the actual decimated data
def __build_intervals_from_decimated_data(elements, resp) def __build_intervals_from_decimated_data(elements, resp)
#compute intervals from resp #compute intervals from resp
start_time = resp.first[0] if(resp.empty?)
end_time = resp.last[0] return {id: e.id, type: 'interval', values: []}
interval_start = start_time end
interval_end = start_time
intervals = [] intervals = []
interval_start = nil
interval_end = nil
resp.each do |row| resp.each do |row|
if row.nil? if row.nil?
intervals += [[interval_start, 0], [interval_end, 0], nil] if !interval_start.nil? && !interval_end.nil?
#interval break and we know the start and end times
intervals += [[interval_start, 0], [interval_end, 0], nil]
end
interval_start = nil interval_start = nil
next next
end end
...@@ -220,8 +224,8 @@ class LoadStreamData ...@@ -220,8 +224,8 @@ class LoadStreamData
interval_end = row[0] interval_end = row[0]
end end
if interval_start != nil if !interval_start.nil? && !interval_end.nil?
intervals += [[interval_start, 0], [end_time, 0]] intervals += [[interval_start, 0], [interval_end, 0]]
end end
elements.map do |e| elements.map do |e|
{ id: e.id, { id: e.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment