fixed analytics time elapsed bug
This commit is contained in:
parent
878c6a38b5
commit
f62ecba90f
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
@ -30,7 +29,7 @@ module.exports = function (io, socket) {
|
|||
ipAddr: data.ipAddr,
|
||||
deviceType: data.deviceType
|
||||
};
|
||||
|
||||
console.log(newVisitor);
|
||||
|
||||
form.analytics.visitors.push(newVisitor);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
|
|||
controller: function($document, $window, $scope){
|
||||
$scope.noscroll = false;
|
||||
$scope.forms = {};
|
||||
TimeCounter.restartClock();
|
||||
|
||||
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
|
||||
if(field.fieldType === 'statement' || field.fieldType === 'rating'){
|
||||
|
@ -79,7 +80,6 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
|
|||
};
|
||||
$scope.setActiveField($scope.myform.visible_form_fields[0]._id, 0, false);
|
||||
|
||||
//console.log($scope.selected);
|
||||
//Reset Timer
|
||||
TimeCounter.restartClock();
|
||||
};
|
||||
|
@ -260,6 +260,8 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
|
|||
});
|
||||
}
|
||||
|
||||
console.log("time elapsed: ");
|
||||
console.log(TimeCounter.getTimeElapsed());
|
||||
SendVisitorData.send($scope.myform, getActiveField(), TimeCounter.getTimeElapsed());
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
}
|
||||
|
||||
$.ajaxSetup( { "async": false } );
|
||||
var geoData = $.getJSON('//freegeoip.net/json/?callback=?');
|
||||
var geoData = $.getJSON('//freegeoip.net/json/').responseJSON;
|
||||
$.ajaxSetup( { "async": true } );
|
||||
|
||||
// Create a new message object
|
||||
|
@ -43,6 +43,7 @@
|
|||
deviceType: deviceType,
|
||||
ipAddr: geoData.ip
|
||||
};
|
||||
console.log('sent form-visitor-data');
|
||||
Socket.emit('form-visitor-data', visitorData);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,8 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
|
||||
stats[deviceType].completion = stats[deviceType].response / stats[deviceType].visits || 0;
|
||||
}
|
||||
console.log("stats");
|
||||
console.log(stats);
|
||||
}
|
||||
|
||||
return stats;
|
||||
|
|
|
@ -145,7 +145,7 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
|||
});
|
||||
});
|
||||
});
|
||||
}else {
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
||||
//FIXME: DAVID: Figure out how to set focus without scroll movement in HTML Dom
|
||||
|
@ -156,6 +156,7 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
SendVisitorData.send($scope.myform, getActiveField(), TimeCounter.getTimeElapsed());
|
||||
};
|
||||
|
||||
|
@ -219,7 +220,6 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
|||
setTimeout(function () {
|
||||
$scope.submitPromise = $http.post('/forms/' + $scope.myform._id, form)
|
||||
.success(function (data, status, headers) {
|
||||
console.log($scope.myform.form_fields[0]);
|
||||
$scope.myform.submitted = true;
|
||||
$scope.loading = false;
|
||||
SendVisitorData.send($scope.myform, getActiveField(), _timeElapsed);
|
||||
|
|
Loading…
Reference in a new issue