Aggiornamento Ore

This commit is contained in:
Paolo Arena
2021-03-17 02:24:11 +01:00
parent 4800186161
commit 678d8ecd6b
14 changed files with 209 additions and 69 deletions

View File

@@ -702,6 +702,48 @@ UserSchema.statics.isUserQualified7 = async function (idapp, username) {
return !!myrec;
};
UserSchema.statics.isUserResidente = async function (idapp, username) {
const User = this;
if (username === undefined)
return false;
const myquery = {
'idapp': idapp,
'username': username,
};
const myrec = await User.findOne(myquery);
if (!!myrec) {
return myrec.profile.socioresidente;
} else {
return false;
}
};
UserSchema.statics.isUserVisuProjects = async function (idapp, username) {
const User = this;
if (username === undefined)
return false;
const myquery = {
'idapp': idapp,
'username': username,
};
const myrec = await User.findOne(myquery);
if (!!myrec) {
return myrec.profile.socioresidente;
} else {
return false;
}
};
UserSchema.statics.isUserAlreadyQualified = async function (idapp, username) {
const User = this;
@@ -2015,7 +2057,7 @@ UserSchema.statics.getUsersRegDaily = function (idapp, nrec) {
}
},
{
$group: { _id: { $dateToString: { format: "%Y-%m-%d", date: "$date_reg" } }, count: { $sum: 1 } }
$group: { _id: { $dateToString: { format: "%Y-%m-%d", date: "$date_reg", timezone: 'Europe/Rome' } }, count: { $sum: 1 } }
},
{
$sort: { _id: 1 }
@@ -2034,7 +2076,7 @@ UserSchema.statics.getUsersRegWeekly = function (idapp, nrec) {
}
},
{
$group: { _id: { $dateToString: { format: "%Y-%U", date: "$date_reg" } }, count: { $sum: 1 } }
$group: { _id: { $dateToString: { format: "%Y-%U", date: "$date_reg", timezone: 'Europe/Rome' } }, count: { $sum: 1 } }
},
{
$sort: { _id: 1 }
@@ -2055,7 +2097,7 @@ UserSchema.statics.getnumRegNDays = function (idapp, nrec) {
}
},
{
$group: { _id: { $dateToString: { format: "%Y-%m-%d", date: "$date_reg" } }, count: { $sum: 1 } }
$group: { _id: { $dateToString: { format: "%Y-%m-%d", date: "$date_reg", timezone: 'Europe/Rome' } }, count: { $sum: 1 } }
},
{
$sort: { _id: 1 }