Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7ac5389a
authored
Apr 27, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug fix for computing decimation intervals
parent
90950d07
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
app/services/data/load_stream_data.rb
app/services/data/load_stream_data.rb
View file @
7ac5389a
...
@@ -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?
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
]
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment