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
7da65920
authored
Apr 05, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added paths to element json
parent
987ae62f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
app/services/data/load_stream_data.rb
app/views/db_elements/data.json.jbuilder
app/services/data/load_stream_data.rb
View file @
7da65920
...
...
@@ -18,13 +18,13 @@ class LoadStreamData
# sets data and data_type
# data_type: raw
# data:
# [{id: element_id, values: [[ts,y],[ts,y],nil,[ts,y]]},...]
# [{id: element_id,
type: raw
values: [[ts,y],[ts,y],nil,[ts,y]]},...]
# data_type: interval
# data:
# [{id: element_id, values: [[start,0],[end,0],nil,...]}]
# [{id: element_id,
type: raw,
values: [[start,0],[end,0],nil,...]}]
# data_type: decimated
# data:
# [{id: element_id, values: [[ts,y,ymin,ymax],[ts,y,ymin,ymax],nil,...]}]
# [{id: element_id,
type: raw,
values: [[ts,y,ymin,ymax],[ts,y,ymin,ymax],nil,...]}]
#
def
run
(
db_stream
,
start_time
,
end_time
)
resolution
=
db_stream
.
db
.
max_points_per_plot
...
...
@@ -152,7 +152,7 @@ class LoadStreamData
def
__build_raw_data
(
db_stream
,
resp
)
elements
=
db_stream
.
db_elements
.
order
(
:column
)
data
=
elements
.
map
{
|
e
|
{
id:
e
.
id
,
values:
[]
}
}
data
=
elements
.
map
{
|
e
|
{
id:
e
.
id
,
type:
'raw'
,
values:
[]
}
}
resp
.
each
do
|
row
|
if
row
.
nil?
# add an interval break to all the elements
data
.
each
{
|
d
|
d
[
:values
].
push
(
nil
)
}
...
...
@@ -168,7 +168,7 @@ class LoadStreamData
def
__build_decimated_data
(
db_stream
,
resp
)
elements
=
db_stream
.
db_elements
.
order
(
:column
)
data
=
elements
.
map
{
|
e
|
{
id:
e
.
id
,
values:
[]
}
}
data
=
elements
.
map
{
|
e
|
{
id:
e
.
id
,
type:
'decimated'
,
values:
[]
}
}
resp
.
each
do
|
row
|
if
row
.
nil?
# add an interval break to all the elements
data
.
each
{
|
d
|
d
[
:values
].
push
(
nil
)
}
...
...
@@ -193,7 +193,7 @@ class LoadStreamData
def
__build_interval_data
(
db_stream
,
resp
)
elements
=
db_stream
.
db_elements
.
order
(
:column
)
elements
.
map
{
|
e
|
{
id:
e
.
id
,
values:
resp
}
}
elements
.
map
{
|
e
|
{
id:
e
.
id
,
type:
'interval'
,
values:
resp
}
}
end
def
__scale_value
(
value
,
element
)
...
...
app/views/db_elements/data.json.jbuilder
View file @
7da65920
...
...
@@ -2,6 +2,7 @@ json.data do
json.array! @service.data.each do |element_data|
json.element_id element_data[:id]
json.data element_data[:values]
json.type element_data[:type]
json.start_time @start_time
json.end_time @end_time
end
...
...
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