Skip to content

Commit

Permalink
Working towards history implementation with series
Browse files Browse the repository at this point in the history
  • Loading branch information
rtvuser1 committed Jun 3, 2018
1 parent 0fe2600 commit 0897c8d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions RTView-Cumulocity-Node/cumulocity_connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ var getMeasurements = function(tableName, res, query, result, callback){
dateTo = new Date(dateTo);
dateFrom = new Date(dateFrom);
//console.log('... measurement interval ' + dateFrom + ' to '+ dateTo + " - tr " + tr);
url += (tableName == 'current' ? '?pageSize=100' : ('/series?series='+fragPath[name]));
/*
//url += (tableName == 'current' ? '?pageSize=100' : ('/series?series='+fragPath[name]));
/**/
if (series) {
seriesPath = name + '.' + series;
console.log('***** seriesPath = ' + seriesPath);
Expand All @@ -272,7 +272,6 @@ var getMeasurements = function(tableName, res, query, result, callback){
console.log('***** fragment = ' + name);
url += (tableName == 'current' ? '?pageSize=100' : ('/series?fragmentType='+name));
}
*/

if (id != '' && id != '*') {
url += ('&source=' + id);
Expand Down Expand Up @@ -360,8 +359,8 @@ var measurementRow = function(row, rtvdata) {
var fragment = row[fragname];

var realfragname = fragname;
if (fragname.startsWith('c8y_'))
realfragname = fragname.substring(4);
//if (fragname.startsWith('c8y_')) // tried to do this for user-friendly, but fails in history
//realfragname = fragname.substring(4);

var serieskeys = Object.keys(fragment);
for (var idxskey in serieskeys) {
Expand Down Expand Up @@ -392,7 +391,11 @@ var measurementRowHistory = function(id,name,seriesname,values) {
rtview_row.push(name);
rtview_row.push(seriesname);
var v = values[ts][0];
rtview_row.push((v.min+v.max)/2.0);
if (v) {
rtview_row.push((v.min+v.max)/2.0);
} else {
rtview_row.push(0.0);
}
rtview_row.push('');
rtview_result.push(rtview_row);
}
Expand Down

0 comments on commit 0897c8d

Please sign in to comment.