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