Fix for POCONSOLE-78.
Alters tag factory to get correct local date time
This commit is contained in:
@@ -6,33 +6,11 @@ poconsole.controller('dashboardCtrl', function($scope, $route, $http, Page, $log
|
||||
var getCurrentValues = Tag.getCurrentValues();
|
||||
getCurrentValues.then(function(data) {
|
||||
$scope.loading = false;
|
||||
$scope.vals = data.vals;
|
||||
$scope.vals = data;
|
||||
$log.info($scope.vals);
|
||||
});
|
||||
};
|
||||
$scope.loadDashboard();
|
||||
|
||||
// $sails.get("/tag_val").success(function(data, status, headers, jwr){
|
||||
// $log.info(data);
|
||||
// });
|
||||
|
||||
// var valHandler = $sails.on('tag_val', function(message){
|
||||
// if (message.verb === "created"){
|
||||
// $log.info(message.data);
|
||||
// for(var i = 0; i < $scope.vals.length; i++){
|
||||
// if(message.data.tagID == $scope.vals[i].t_id){
|
||||
// $scope.vals[i].val = message.data.val;
|
||||
// $scope.vals[i].dtime = message.data.createdAt;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// $scope.$on('$destroy', function() {
|
||||
// $sails.off('tag_val', valHandler);
|
||||
// });
|
||||
|
||||
|
||||
});
|
||||
|
||||
poconsole.controller('todaysTotalsCtrl', function($scope, $route, $http, Page, $log, Tag) {
|
||||
|
||||
@@ -52,10 +52,11 @@ poconsole.factory('Tag',function($q, $http, $log, dateConversion){
|
||||
service.getCurrentValues = function(){
|
||||
var deferred = $q.defer();
|
||||
$http.get('/api/latest').success(function(data) {
|
||||
data = data.map(makeDateinObject);
|
||||
deferred.resolve({
|
||||
vals:data
|
||||
});
|
||||
var vals = data.map(function(v){
|
||||
v.created_on = Date.create(v.created_on + "Z", { fromUTC: true });
|
||||
return v;
|
||||
});
|
||||
deferred.resolve(vals);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
@@ -140,7 +141,11 @@ poconsole.factory('Tag',function($q, $http, $log, dateConversion){
|
||||
service.getTagsAtTime = function(dt){
|
||||
var deferred = $q.defer();
|
||||
$http.get('/api/tagsattime/' + dt).success(function(data) {
|
||||
deferred.resolve(data);
|
||||
var vals = data.map(function(v){
|
||||
v.created_on = Date.create(v.created_on + "Z", { fromUTC: true });
|
||||
return v;
|
||||
});
|
||||
deferred.resolve(vals);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user