+ Registered Users
+ UsersList Online
This commit is contained in:
@@ -164,6 +164,7 @@ ExtraListSchema.statics.getUsersList = function (idapp) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
date_reg: 1,
|
||||
})
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
"profile.mygroups": 1,
|
||||
'profile.qualifica': 1,
|
||||
|
||||
@@ -167,6 +167,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
|
||||
@@ -167,6 +167,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
|
||||
@@ -168,6 +168,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
|
||||
@@ -731,6 +731,7 @@ sendNotifSchema.statics.sendToTheDestinations = async function(myrecnotifpass, r
|
||||
}, {
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
lang: 1,
|
||||
username: 1,
|
||||
'profile.notifs': 1,
|
||||
|
||||
@@ -710,6 +710,7 @@ UserSchema.statics.getProjectUser = function() {
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
deleted: 1,
|
||||
reported: 1,
|
||||
date_report: 1,
|
||||
@@ -1467,6 +1468,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
deleted: 1,
|
||||
sospeso: 1,
|
||||
reported: 1,
|
||||
@@ -1507,6 +1509,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
deleted: 1,
|
||||
sospeso: 1,
|
||||
reported: 1,
|
||||
@@ -1547,6 +1550,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
deleted: 1,
|
||||
sospeso: 1,
|
||||
reported: 1,
|
||||
@@ -2429,6 +2433,7 @@ function getWhatToShow(idapp, username) {
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
deleted: 1,
|
||||
sospeso: 1,
|
||||
reported: 1,
|
||||
@@ -3040,6 +3045,7 @@ UserSchema.statics.getUsersList = function(idapp) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
verified_email: 1,
|
||||
verified_by_aportador: 1,
|
||||
made_gift: 1,
|
||||
@@ -3232,11 +3238,26 @@ UserSchema.statics.getUsersRegistered = async function(idapp) {
|
||||
return await User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersRegisteredToday = async function (idapp) {
|
||||
const User = this;
|
||||
|
||||
let starttoday = new Date();
|
||||
starttoday.setHours(0, 0, 0, 0);
|
||||
|
||||
const myfind = {
|
||||
idapp,
|
||||
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||
date_reg: { $gt: starttoday },
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersOnLineToday = async function (idapp) {
|
||||
const User = this;
|
||||
|
||||
let starttoday = new Date();
|
||||
starttoday.setHours(6, 0, 0, 0);
|
||||
starttoday.setHours(0, 0, 0, 0);
|
||||
|
||||
const myfind = {
|
||||
idapp,
|
||||
@@ -3442,6 +3463,8 @@ UserSchema.statics.getLastUsers = async function(idapp) {
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
date_reg: 1,
|
||||
index: 1,
|
||||
'profile.nationality': 1,
|
||||
@@ -3452,6 +3475,32 @@ UserSchema.statics.getLastUsers = async function(idapp) {
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.getLastOnlineUsers = async function (idapp) {
|
||||
const User = this;
|
||||
|
||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_ONLINE_USERS', 10);
|
||||
|
||||
return await User.find(
|
||||
{
|
||||
idapp,
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
},
|
||||
{
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
index: 1,
|
||||
}).sort({ lasttimeonline: -1 }).limit(lastn).then((arr) => {
|
||||
//return JSON.stringify(arr)
|
||||
return arr;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.checkUser = async function (idapp, username) {
|
||||
const User = this;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ router.post('/load', async (req, res) => {
|
||||
|
||||
let datastat = {
|
||||
num_reg: await User.getUsersRegistered(idapp),
|
||||
num_reg_today: await User.getUsersRegisteredToday(idapp),
|
||||
online_today: await User.getUsersOnLineToday(idapp),
|
||||
// num_passeggeri: await 0,
|
||||
// num_imbarcati: 0,
|
||||
@@ -46,6 +47,7 @@ router.post('/load', async (req, res) => {
|
||||
// imbarcati_weekly: 0,
|
||||
reg_weekly: await User.calcRegWeekly(idapp),
|
||||
lastsreg: await User.getLastUsers(idapp),
|
||||
lastsonline: await User.getLastOnlineUsers(idapp),
|
||||
checkuser: await User.checkUser(idapp, username),
|
||||
// navi_partite: await Nave.getNaviPartite(idapp),
|
||||
// navi_in_partenza: await Nave.getNaviInPartenza(idapp),
|
||||
|
||||
Reference in New Issue
Block a user