This commit is contained in:
Paolo Arena
2021-02-18 12:19:35 +01:00
parent 88ae9af12c
commit 14a3292da2
22 changed files with 233 additions and 122 deletions

View File

@@ -26,6 +26,12 @@ const bookingSchema = new Schema({
numpeople: {
type: Number,
},
numpeopleLunch: {
type: Number,
},
numpeopleDinner: {
type: Number,
},
infoevent: {
type: String,
},

View File

@@ -1208,11 +1208,12 @@ ListaIngressoSchema.statics.getnumInvitati = async function (idapp, username) {
ListaIngressoSchema.statics.Esegui_CronTab = async function (idapp, mydata) {
const ListaIngresso = this;
console.log('Lancia CronTab: [IDAPP=' + idapp + ']');
// console.log('Lancia CronTab: [IDAPP=' + idapp + ']');
let num = 0;
try {
/*
if (!await Graduatoria.isUpdating()) {
await Graduatoria.setGradUpdating(idapp, true);
@@ -1222,14 +1223,14 @@ ListaIngressoSchema.statics.Esegui_CronTab = async function (idapp, mydata) {
await Graduatoria.setWorking(idapp, false);
num = await Nave.generaNave(idapp, mydata, false);
}
}*/
} catch (e) {
console.error('ERRORE CronTab: [IDAPP=' + idapp + ']', e.message);
} finally {
await Graduatoria.setGradUpdating(idapp, false);
await Graduatoria.setWorking(idapp, false);
// await Graduatoria.setGradUpdating(idapp, false);
// await Graduatoria.setWorking(idapp, false);
console.log('FINE CronTab: [IDAPP=' + idapp + ']');
}

View File

@@ -88,6 +88,27 @@ const MyEventSchema = new Schema({
canceled: {
type: Boolean,
},
lunchAvailable: {
type: Boolean,
},
dinnerAvailable: {
type: Boolean,
},
lunchType: {
type: Number,
},
dinnerType: {
type: Number,
},
lunchPrice: {
type: Number,
},
dinnerPrice: {
type: Number,
},
internal: {
type: Boolean,
},
deleted: {
type: Boolean,
},
@@ -99,13 +120,33 @@ const MyEventSchema = new Schema({
},
});
MyEventSchema.statics.findAllIdApp = function (idapp) {
MyEventSchema.statics.findAllIdApp = function (socioresidente, idapp) {
const Event = this;
const query = [
{ $match: { idapp } },
{ $sort: { dateTimeStart: 1 } }
];
let query = []
if (socioresidente) {
query = [
{
$match: {
idapp,
}
}
]
} else {
query = [
{
$match: {
idapp,
$or: [
{ $or: [{ internal: { $exists: false } }, { internal: { $exists: true, $eq: false } }] },
],
}
}
]
}
query.push({ $sort: { dateTimeStart: 1 } })
return Event
.aggregate(query)

View File

@@ -188,7 +188,7 @@ ProjectSchema.statics.findAllProjByUserId = async function (userId, idapp) {
{
$and: [
{ idapp }, {
$or: [{ privacyread: server_constants.Privacy.all }, { userId: userId }],
$or: [{ privacyread: { $ne: server_constants.Privacy.onlyme } }, { userId: userId }],
}],
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
}
@@ -336,7 +336,7 @@ ProjectSchema.statics.enabletoModify = async function (userId, idProj) {
return Project.findOne({
'_id': idProj,
$or: [{
privacywrite: server_constants.Privacy.all,
privacywrite: { $ne: server_constants.Privacy.onlyme },
userId: userId
}]
}).then(ris => {

View File

@@ -59,7 +59,7 @@ SettingsSchema.statics.getValDbSettings = function (idapp, key, def) {
if (!!myrec) {
if (myrec.type === tools.FieldType.date)
return myrec.value_date;
else if (myrec.type === tools.FieldType.number)
else if ((myrec.type === tools.FieldType.number) || (myrec.type === tools.FieldType.hours))
return myrec.value_num;
else if (myrec.type === tools.FieldType.boolean)
return myrec.value_bool;

View File

@@ -62,6 +62,7 @@ var TodoSchema = new mongoose.Schema({
},
phase: {
type: Number,
default: 1
},
assignedToUsers: [
{ type: String }
@@ -127,7 +128,7 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
function getQueryFilterTodo(userId) {
let myobj = [
{ userId: userId },
// { userId: userId },
{
$or:
[{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]