|
|
|
@ -3,13 +3,13 @@ import Users from '../users'; |
|
|
|
|
|
|
|
|
|
function acceptedIpAdress(ipAdress) { |
|
|
|
|
//return true if a given ipAdress was setted by an admin user
|
|
|
|
|
console.log('idpAdress', ipAdress); |
|
|
|
|
// console.log('idpAdress', ipAdress);
|
|
|
|
|
|
|
|
|
|
//Check if ipAdress is accepted
|
|
|
|
|
console.log( |
|
|
|
|
'process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS', |
|
|
|
|
process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS, |
|
|
|
|
); |
|
|
|
|
// console.log(
|
|
|
|
|
// 'process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS',
|
|
|
|
|
// process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS,
|
|
|
|
|
// );
|
|
|
|
|
//console.log("process.env", process.env);
|
|
|
|
|
const trustedIpAdress = process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS; |
|
|
|
|
//console.log("trustedIpAdress", trustedIpAdress);
|
|
|
|
@ -102,7 +102,7 @@ Meteor.startup(() => { |
|
|
|
|
let dateWithXdaysAgo = new Date( |
|
|
|
|
new Date() - xdays * 24 * 60 * 60 * 1000, |
|
|
|
|
); |
|
|
|
|
console.log({ dateWithXdaysAgo }); |
|
|
|
|
//console.log({ dateWithXdaysAgo });
|
|
|
|
|
resCount = Users.find({ |
|
|
|
|
lastConnectionDate: { $gte: dateWithXdaysAgo }, |
|
|
|
|
}).count(); // KPI 5
|
|
|
|
@ -115,7 +115,7 @@ Meteor.startup(() => { |
|
|
|
|
// To Do: Get number of users with last connection dated 10 days ago
|
|
|
|
|
xdays = 10; |
|
|
|
|
dateWithXdaysAgo = new Date(new Date() - xdays * 24 * 60 * 60 * 1000); |
|
|
|
|
console.log({ dateWithXdaysAgo }); |
|
|
|
|
//console.log({ dateWithXdaysAgo });
|
|
|
|
|
resCount = Users.find({ |
|
|
|
|
lastConnectionDate: { $gte: dateWithXdaysAgo }, |
|
|
|
|
}).count(); // KPI 5
|
|
|
|
@ -123,6 +123,33 @@ Meteor.startup(() => { |
|
|
|
|
'usersWithLastConnectionDated10DaysAgo ' + resCount + '\n'; |
|
|
|
|
resCount = 0; |
|
|
|
|
|
|
|
|
|
metricsRes += |
|
|
|
|
'# Number of users with last connection dated 20 days ago\n'; |
|
|
|
|
|
|
|
|
|
// To Do: Get number of users with last connection dated 20 days ago
|
|
|
|
|
xdays = 20; |
|
|
|
|
dateWithXdaysAgo = new Date(new Date() - xdays * 24 * 60 * 60 * 1000); |
|
|
|
|
//console.log({ dateWithXdaysAgo });
|
|
|
|
|
resCount = Users.find({ |
|
|
|
|
lastConnectionDate: { $gte: dateWithXdaysAgo }, |
|
|
|
|
}).count(); // KPI 5
|
|
|
|
|
metricsRes += |
|
|
|
|
'usersWithLastConnectionDated20DaysAgo ' + resCount + '\n'; |
|
|
|
|
resCount = 0; |
|
|
|
|
|
|
|
|
|
metricsRes += |
|
|
|
|
'# Number of users with last connection dated 30 days ago\n'; |
|
|
|
|
|
|
|
|
|
// To Do: Get number of users with last connection dated 20 days ago
|
|
|
|
|
xdays = 30; |
|
|
|
|
dateWithXdaysAgo = new Date(new Date() - xdays * 24 * 60 * 60 * 1000); |
|
|
|
|
//console.log({ dateWithXdaysAgo });
|
|
|
|
|
resCount = Users.find({ |
|
|
|
|
lastConnectionDate: { $gte: dateWithXdaysAgo }, |
|
|
|
|
}).count(); // KPI 5
|
|
|
|
|
metricsRes += |
|
|
|
|
'usersWithLastConnectionDated30DaysAgo ' + resCount + '\n'; |
|
|
|
|
resCount = 0; |
|
|
|
|
// TO DO:
|
|
|
|
|
// moyenne de connexion : ((date de déconnexion - date de dernière connexion) + (dernière moyenne)) / 2
|
|
|
|
|
// KPI 7 : somme des moyenne de connexion / nombre d'utilisateur (à ignore les utilisateur avec 0 moyenne)
|
|
|
|
|