mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Refactoring(metrics KPI): Added some metrics KPI Datas
This commit is contained in:
parent
d323c1e51e
commit
d2436ba001
1 changed files with 34 additions and 7 deletions
|
|
@ -3,13 +3,13 @@ import Users from '../users';
|
||||||
|
|
||||||
function acceptedIpAdress(ipAdress) {
|
function acceptedIpAdress(ipAdress) {
|
||||||
//return true if a given ipAdress was setted by an admin user
|
//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
|
//Check if ipAdress is accepted
|
||||||
console.log(
|
// console.log(
|
||||||
'process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS',
|
// 'process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS',
|
||||||
process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS,
|
// process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS,
|
||||||
);
|
// );
|
||||||
//console.log("process.env", process.env);
|
//console.log("process.env", process.env);
|
||||||
const trustedIpAdress = process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS;
|
const trustedIpAdress = process.env.WEKAN_METRICS_ACCEPTED_IP_ADRESS;
|
||||||
//console.log("trustedIpAdress", trustedIpAdress);
|
//console.log("trustedIpAdress", trustedIpAdress);
|
||||||
|
|
@ -102,7 +102,7 @@ Meteor.startup(() => {
|
||||||
let dateWithXdaysAgo = new Date(
|
let dateWithXdaysAgo = new Date(
|
||||||
new Date() - xdays * 24 * 60 * 60 * 1000,
|
new Date() - xdays * 24 * 60 * 60 * 1000,
|
||||||
);
|
);
|
||||||
console.log({ dateWithXdaysAgo });
|
//console.log({ dateWithXdaysAgo });
|
||||||
resCount = Users.find({
|
resCount = Users.find({
|
||||||
lastConnectionDate: { $gte: dateWithXdaysAgo },
|
lastConnectionDate: { $gte: dateWithXdaysAgo },
|
||||||
}).count(); // KPI 5
|
}).count(); // KPI 5
|
||||||
|
|
@ -115,7 +115,7 @@ Meteor.startup(() => {
|
||||||
// To Do: Get number of users with last connection dated 10 days ago
|
// To Do: Get number of users with last connection dated 10 days ago
|
||||||
xdays = 10;
|
xdays = 10;
|
||||||
dateWithXdaysAgo = new Date(new Date() - xdays * 24 * 60 * 60 * 1000);
|
dateWithXdaysAgo = new Date(new Date() - xdays * 24 * 60 * 60 * 1000);
|
||||||
console.log({ dateWithXdaysAgo });
|
//console.log({ dateWithXdaysAgo });
|
||||||
resCount = Users.find({
|
resCount = Users.find({
|
||||||
lastConnectionDate: { $gte: dateWithXdaysAgo },
|
lastConnectionDate: { $gte: dateWithXdaysAgo },
|
||||||
}).count(); // KPI 5
|
}).count(); // KPI 5
|
||||||
|
|
@ -123,6 +123,33 @@ Meteor.startup(() => {
|
||||||
'usersWithLastConnectionDated10DaysAgo ' + resCount + '\n';
|
'usersWithLastConnectionDated10DaysAgo ' + resCount + '\n';
|
||||||
resCount = 0;
|
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:
|
// TO DO:
|
||||||
// moyenne de connexion : ((date de déconnexion - date de dernière connexion) + (dernière moyenne)) / 2
|
// 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)
|
// KPI 7 : somme des moyenne de connexion / nombre d'utilisateur (à ignore les utilisateur avec 0 moyenne)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue