Lista Doni Navi
This commit is contained in:
0
.directory
Normal file → Executable file
0
.directory
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
css/basic.css
Normal file → Executable file
0
css/basic.css
Normal file → Executable file
0
css/one/styles.css
Normal file → Executable file
0
css/one/styles.css
Normal file → Executable file
0
docs/email.md
Normal file → Executable file
0
docs/email.md
Normal file → Executable file
0
ecosystem.config.js
Normal file → Executable file
0
ecosystem.config.js
Normal file → Executable file
0
emails/admin/added_to_newsletter/it/html.pug
Normal file → Executable file
0
emails/admin/added_to_newsletter/it/html.pug
Normal file → Executable file
0
emails/admin/added_to_newsletter/it/subject.pug
Normal file → Executable file
0
emails/admin/added_to_newsletter/it/subject.pug
Normal file → Executable file
0
emails/admin/cancelbooking/it/html.pug
Normal file → Executable file
0
emails/admin/cancelbooking/it/html.pug
Normal file → Executable file
0
emails/admin/cancelbooking/it/subject.pug
Normal file → Executable file
0
emails/admin/cancelbooking/it/subject.pug
Normal file → Executable file
0
emails/admin/makebooking/it/html.pug
Normal file → Executable file
0
emails/admin/makebooking/it/html.pug
Normal file → Executable file
0
emails/admin/makebooking/it/subject.pug
Normal file → Executable file
0
emails/admin/makebooking/it/subject.pug
Normal file → Executable file
0
emails/admin/modifybooking/it/html.pug
Normal file → Executable file
0
emails/admin/modifybooking/it/html.pug
Normal file → Executable file
0
emails/admin/modifybooking/it/subject.pug
Normal file → Executable file
0
emails/admin/modifybooking/it/subject.pug
Normal file → Executable file
0
emails/admin/registration/enUs/html.pug
Normal file → Executable file
0
emails/admin/registration/enUs/html.pug
Normal file → Executable file
0
emails/admin/registration/enUs/subject.pug
Normal file → Executable file
0
emails/admin/registration/enUs/subject.pug
Normal file → Executable file
0
emails/admin/registration/es/html.pug
Normal file → Executable file
0
emails/admin/registration/es/html.pug
Normal file → Executable file
0
emails/admin/registration/es/subject.pug
Normal file → Executable file
0
emails/admin/registration/es/subject.pug
Normal file → Executable file
0
emails/admin/registration/it/html.pug
Normal file → Executable file
0
emails/admin/registration/it/html.pug
Normal file → Executable file
0
emails/admin/registration/it/subject.pug
Normal file → Executable file
0
emails/admin/registration/it/subject.pug
Normal file → Executable file
0
emails/admin/registration/it/text.pug
Normal file → Executable file
0
emails/admin/registration/it/text.pug
Normal file → Executable file
0
emails/booking/cancelbooking/it/html.pug
Normal file → Executable file
0
emails/booking/cancelbooking/it/html.pug
Normal file → Executable file
0
emails/booking/cancelbooking/it/subject.pug
Normal file → Executable file
0
emails/booking/cancelbooking/it/subject.pug
Normal file → Executable file
0
emails/booking/makebooking/it/html.pug
Normal file → Executable file
0
emails/booking/makebooking/it/html.pug
Normal file → Executable file
0
emails/booking/makebooking/it/subject.pug
Normal file → Executable file
0
emails/booking/makebooking/it/subject.pug
Normal file → Executable file
0
emails/booking/modifybooking/it/html.pug
Normal file → Executable file
0
emails/booking/modifybooking/it/html.pug
Normal file → Executable file
0
emails/booking/modifybooking/it/subject.pug
Normal file → Executable file
0
emails/booking/modifybooking/it/subject.pug
Normal file → Executable file
0
emails/msg/sendmsg/it/html.pug
Normal file → Executable file
0
emails/msg/sendmsg/it/html.pug
Normal file → Executable file
0
emails/msg/sendmsg/it/subject.pug
Normal file → Executable file
0
emails/msg/sendmsg/it/subject.pug
Normal file → Executable file
0
emails/msg/sendmsgchat/it/html.pug
Normal file → Executable file
0
emails/msg/sendmsgchat/it/html.pug
Normal file → Executable file
0
emails/msg/sendmsgchat/it/subject.pug
Normal file → Executable file
0
emails/msg/sendmsgchat/it/subject.pug
Normal file → Executable file
0
emails/newsletter/it/html.pug
Normal file → Executable file
0
emails/newsletter/it/html.pug
Normal file → Executable file
0
emails/newsletter/it/subject.pug
Normal file → Executable file
0
emails/newsletter/it/subject.pug
Normal file → Executable file
0
emails/one/one.template.pug
Normal file → Executable file
0
emails/one/one.template.pug
Normal file → Executable file
0
emails/registration/enUs/html.pug
Normal file → Executable file
0
emails/registration/enUs/html.pug
Normal file → Executable file
0
emails/registration/enUs/subject.pug
Normal file → Executable file
0
emails/registration/enUs/subject.pug
Normal file → Executable file
0
emails/registration/esEs/html.pug
Normal file → Executable file
0
emails/registration/esEs/html.pug
Normal file → Executable file
0
emails/registration/esEs/subject.pug
Normal file → Executable file
0
emails/registration/esEs/subject.pug
Normal file → Executable file
0
emails/registration/it/html.pug
Normal file → Executable file
0
emails/registration/it/html.pug
Normal file → Executable file
0
emails/registration/it/subject.pug
Normal file → Executable file
0
emails/registration/it/subject.pug
Normal file → Executable file
0
emails/registration_ayni/enUs/html.pug
Normal file → Executable file
0
emails/registration_ayni/enUs/html.pug
Normal file → Executable file
0
emails/registration_ayni/enUs/subject.pug
Normal file → Executable file
0
emails/registration_ayni/enUs/subject.pug
Normal file → Executable file
0
emails/registration_ayni/es/html.pug
Normal file → Executable file
0
emails/registration_ayni/es/html.pug
Normal file → Executable file
0
emails/registration_ayni/es/subject.pug
Normal file → Executable file
0
emails/registration_ayni/es/subject.pug
Normal file → Executable file
0
emails/registration_ayni/fr/html.pug
Normal file → Executable file
0
emails/registration_ayni/fr/html.pug
Normal file → Executable file
0
emails/registration_ayni/fr/subject.pug
Normal file → Executable file
0
emails/registration_ayni/fr/subject.pug
Normal file → Executable file
0
emails/registration_ayni/it/html.pug
Normal file → Executable file
0
emails/registration_ayni/it/html.pug
Normal file → Executable file
0
emails/registration_ayni/it/subject.pug
Normal file → Executable file
0
emails/registration_ayni/it/subject.pug
Normal file → Executable file
0
emails/registration_ayni/pt/html.pug
Normal file → Executable file
0
emails/registration_ayni/pt/html.pug
Normal file → Executable file
0
emails/registration_ayni/pt/subject.pug
Normal file → Executable file
0
emails/registration_ayni/pt/subject.pug
Normal file → Executable file
0
emails/registration_ayni/si/html.pug
Normal file → Executable file
0
emails/registration_ayni/si/html.pug
Normal file → Executable file
0
emails/registration_ayni/si/subject.pug
Normal file → Executable file
0
emails/registration_ayni/si/subject.pug
Normal file → Executable file
0
emails/resetpwd/en/html.pug
Normal file → Executable file
0
emails/resetpwd/en/html.pug
Normal file → Executable file
0
emails/resetpwd/en/subject.pug
Normal file → Executable file
0
emails/resetpwd/en/subject.pug
Normal file → Executable file
0
emails/resetpwd/es/html.pug
Normal file → Executable file
0
emails/resetpwd/es/html.pug
Normal file → Executable file
0
emails/resetpwd/es/subject.pug
Normal file → Executable file
0
emails/resetpwd/es/subject.pug
Normal file → Executable file
0
emails/resetpwd/it/html.pug
Normal file → Executable file
0
emails/resetpwd/it/html.pug
Normal file → Executable file
0
emails/resetpwd/it/subject.pug
Normal file → Executable file
0
emails/resetpwd/it/subject.pug
Normal file → Executable file
0
gulpfile.js
Normal file → Executable file
0
gulpfile.js
Normal file → Executable file
0
package.json
Normal file → Executable file
0
package.json
Normal file → Executable file
0
plugins/file.js
Normal file → Executable file
0
plugins/file.js
Normal file → Executable file
0
plugins/googleapi.js
Normal file → Executable file
0
plugins/googleapi.js
Normal file → Executable file
0
sass/basic.scss
Normal file → Executable file
0
sass/basic.scss
Normal file → Executable file
0
sass/one/styles.scss
Normal file → Executable file
0
sass/one/styles.scss
Normal file → Executable file
0
src/server/calculations/todo.js
Normal file → Executable file
0
src/server/calculations/todo.js
Normal file → Executable file
0
src/server/classes/queryclass.js
Normal file → Executable file
0
src/server/classes/queryclass.js
Normal file → Executable file
0
src/server/config/config.js
Normal file → Executable file
0
src/server/config/config.js
Normal file → Executable file
0
src/server/db/mongoose.js
Normal file → Executable file
0
src/server/db/mongoose.js
Normal file → Executable file
0
src/server/ftp/FTPClient.js
Normal file → Executable file
0
src/server/ftp/FTPClient.js
Normal file → Executable file
0
src/server/locales/back/en.json
Normal file → Executable file
0
src/server/locales/back/en.json
Normal file → Executable file
0
src/server/locales/back/es.json
Normal file → Executable file
0
src/server/locales/back/es.json
Normal file → Executable file
0
src/server/locales/back/it.json
Normal file → Executable file
0
src/server/locales/back/it.json
Normal file → Executable file
0
src/server/locales/en.json
Normal file → Executable file
0
src/server/locales/en.json
Normal file → Executable file
0
src/server/locales/es.json
Normal file → Executable file
0
src/server/locales/es.json
Normal file → Executable file
0
src/server/locales/it.json
Normal file → Executable file
0
src/server/locales/it.json
Normal file → Executable file
0
src/server/middleware/authenticate.js
Normal file → Executable file
0
src/server/middleware/authenticate.js
Normal file → Executable file
0
src/server/models/booking.js
Normal file → Executable file
0
src/server/models/booking.js
Normal file → Executable file
2
src/server/models/calzoom.js
Normal file → Executable file
2
src/server/models/calzoom.js
Normal file → Executable file
@@ -40,7 +40,7 @@ const CalZoomSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
CalZoomSchema.statics.getFieldsForSearch = function () {
|
CalZoomSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['title']
|
return [{field: 'title', type: tools.FieldType.string}]
|
||||||
};
|
};
|
||||||
|
|
||||||
CalZoomSchema.statics.executeQueryTable = function (idapp, params) {
|
CalZoomSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
0
src/server/models/cfgserver.js
Normal file → Executable file
0
src/server/models/cfgserver.js
Normal file → Executable file
2
src/server/models/contribtype.js
Normal file → Executable file
2
src/server/models/contribtype.js
Normal file → Executable file
@@ -25,7 +25,7 @@ const ContribtypeSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
ContribtypeSchema.statics.getFieldsForSearch = function () {
|
ContribtypeSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['label']
|
return [{field: 'label', type: tools.FieldType.string}]
|
||||||
};
|
};
|
||||||
|
|
||||||
ContribtypeSchema.statics.executeQueryTable = function (idapp, params) {
|
ContribtypeSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
3
src/server/models/discipline.js
Normal file → Executable file
3
src/server/models/discipline.js
Normal file → Executable file
@@ -89,7 +89,8 @@ DisciplineSchema.statics.getDisciplineforNewsletter = function (idapp) {
|
|||||||
|
|
||||||
|
|
||||||
DisciplineSchema.statics.getFieldsForSearch = function () {
|
DisciplineSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['label', 'description']
|
return [{ field: 'label', type: tools.FieldType.string },
|
||||||
|
{ field: 'description', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
DisciplineSchema.statics.executeQueryTable = function (idapp, params) {
|
DisciplineSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
8
src/server/models/extralist.js
Normal file → Executable file
8
src/server/models/extralist.js
Normal file → Executable file
@@ -208,7 +208,12 @@ ExtraListSchema.statics.getUserNotRegisteredByNameSurname = function (idapp, nam
|
|||||||
|
|
||||||
|
|
||||||
ExtraListSchema.statics.getFieldsForSearch = function () {
|
ExtraListSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['username', 'name', 'surname', 'cell_complete', 'aportador_solidario_name_surname', 'aportador_solidario_originale_name_surname']
|
return [{ field: 'username', type: tools.FieldType.string },
|
||||||
|
{ field: 'name', type: tools.FieldType.string },
|
||||||
|
{ field: 'surname', type: tools.FieldType.string },
|
||||||
|
{ field: 'cell_complete', type: tools.FieldType.string },
|
||||||
|
{ field: 'aportador_solidario_name_surname', type: tools.FieldType.string },
|
||||||
|
{ field: 'aportador_solidario_originale_name_surname', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
ExtraListSchema.statics.executeQueryTable = function (idapp, params) {
|
ExtraListSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -321,7 +326,6 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
|
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
src/server/models/gallery.js
Normal file → Executable file
2
src/server/models/gallery.js
Normal file → Executable file
@@ -44,7 +44,7 @@ const GallerySchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
GallerySchema.statics.getFieldsForSearch = function () {
|
GallerySchema.statics.getFieldsForSearch = function () {
|
||||||
return ['title']
|
return [{ field: 'title', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
GallerySchema.statics.executeQueryTable = function (idapp, params) {
|
GallerySchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
11
src/server/models/listaingresso.js
Normal file → Executable file
11
src/server/models/listaingresso.js
Normal file → Executable file
@@ -144,8 +144,8 @@ ListaIngressoSchema.statics.addUserInListaIngresso = async function (idapp, ind_
|
|||||||
const telegrambot = require('../telegram/telegrambot');
|
const telegrambot = require('../telegram/telegrambot');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let listaingresso = null;
|
let listaingresso = await ListaIngresso.findByIndOrderETess(idapp, ind_order, num_tess);
|
||||||
if (!await ListaIngresso.findByIndOrderETess(idapp, ind_order, num_tess)) {
|
if (!listaingresso) {
|
||||||
listaingresso = new ListaIngresso({
|
listaingresso = new ListaIngresso({
|
||||||
ind_order: ind_order,
|
ind_order: ind_order,
|
||||||
idapp,
|
idapp,
|
||||||
@@ -168,11 +168,11 @@ ListaIngressoSchema.statics.addUserInListaIngresso = async function (idapp, ind_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const giapresente = await Nave.findOne({ idapp, ind_order: num_tess });
|
const giapresente = await Nave.findOne({ idapp, ind_order, num_tess });
|
||||||
if (!!giapresente) {
|
if (!!giapresente) {
|
||||||
// Era stato già aggiunto!
|
// Era stato già aggiunto!
|
||||||
let fields_to_update = { added: true };
|
let fields_to_update = { added: true };
|
||||||
await ListaIngresso.findOneAndUpdate({ _id: params.id.toString() }, { $set: fields_to_update }, { new: false });
|
await ListaIngresso.findOneAndUpdate({ _id: listaingresso._id }, { $set: fields_to_update }, { new: false });
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ ListaIngressoSchema.statics.showListaOrd = async function (idapp) {
|
|||||||
|
|
||||||
|
|
||||||
ListaIngressoSchema.statics.getFieldsForSearch = function () {
|
ListaIngressoSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['ind_order']
|
return [{field: 'ind_order', type: tools.FieldType.number }]
|
||||||
};
|
};
|
||||||
|
|
||||||
ListaIngressoSchema.statics.executeQueryTable = function (idapp, params) {
|
ListaIngressoSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -273,6 +273,7 @@ ListaIngressoSchema.statics.getProssimiInLista = async function (idapp, tutti) {
|
|||||||
if (rec.numinvitatiattivi > 2)
|
if (rec.numinvitatiattivi > 2)
|
||||||
rec.numinvitatiattivi = 2;
|
rec.numinvitatiattivi = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arrlista) {
|
if (arrlista) {
|
||||||
arrlista = sortRec(arrlista);
|
arrlista = sortRec(arrlista);
|
||||||
// arrlista.reverse();
|
// arrlista.reverse();
|
||||||
|
|||||||
8
src/server/models/mailinglist.js
Normal file → Executable file
8
src/server/models/mailinglist.js
Normal file → Executable file
@@ -45,7 +45,9 @@ const MailingListSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
MailingListSchema.statics.getFieldsForSearch = function () {
|
MailingListSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['name', 'surname', 'email']
|
return [{ field: 'name', type: tools.FieldType.string },
|
||||||
|
{ field: 'surname', type: tools.FieldType.string },
|
||||||
|
{ field: 'email', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
MailingListSchema.statics.executeQueryTable = function (idapp, params) {
|
MailingListSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -56,7 +58,7 @@ MailingListSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
|
MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
|
||||||
const MailingList = this;
|
const MailingList = this;
|
||||||
|
|
||||||
const myfind = { idapp, statesub: true, wrongerr: {$ne: true} };
|
const myfind = { idapp, statesub: true, wrongerr: { $ne: true } };
|
||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||||
|
|
||||||
@@ -78,7 +80,7 @@ MailingListSchema.statics.getnumSent = async function (idapp, idmailinglist) {
|
|||||||
MailingListSchema.statics.isOk = async function (idapp, iduser, idmailinglist) {
|
MailingListSchema.statics.isOk = async function (idapp, iduser, idmailinglist) {
|
||||||
const MailingList = this;
|
const MailingList = this;
|
||||||
|
|
||||||
const myfind = { idapp, _id: iduser, statesub: true, lastid_newstosent: {$ne: idmailinglist } };
|
const myfind = { idapp, _id: iduser, statesub: true, lastid_newstosent: { $ne: idmailinglist } };
|
||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||||
|
|
||||||
|
|||||||
7
src/server/models/myevent.js
Normal file → Executable file
7
src/server/models/myevent.js
Normal file → Executable file
@@ -121,7 +121,7 @@ MyEventSchema.statics.getLastEvents = async function (idapp) {
|
|||||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_EV', 1);
|
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_EV', 1);
|
||||||
|
|
||||||
const query = [
|
const query = [
|
||||||
{ $match: { idapp, dateTimeStart: { $gte: tools.IncDateNow(- 1000 * 60 * 60 * 24) } } },
|
{ $match: { idapp, dateTimeStart: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 24) } } },
|
||||||
{
|
{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
from: 'operators',
|
from: 'operators',
|
||||||
@@ -165,7 +165,10 @@ MyEventSchema.statics.getLastEvents = async function (idapp) {
|
|||||||
|
|
||||||
|
|
||||||
MyEventSchema.statics.getFieldsForSearch = function () {
|
MyEventSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['short_tit', 'title', 'teacher', 'details']
|
return [{ field: 'short_tit', type: tools.FieldType.string },
|
||||||
|
{ field: 'title', type: tools.FieldType.string },
|
||||||
|
{ field: 'teacher', type: tools.FieldType.string },
|
||||||
|
{ field: 'details', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
MyEventSchema.statics.executeQueryTable = function (idapp, params) {
|
MyEventSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
5
src/server/models/mypage.js
Normal file → Executable file
5
src/server/models/mypage.js
Normal file → Executable file
@@ -74,7 +74,10 @@ const MyPageSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
MyPageSchema.statics.getFieldsForSearch = function () {
|
MyPageSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['title', 'keywords', 'description', 'content']
|
return [{ field: 'title', type: tools.FieldType.string },
|
||||||
|
{ field: 'keywords', type: tools.FieldType.string },
|
||||||
|
{ field: 'description', type: tools.FieldType.string },
|
||||||
|
{ field: 'content', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
MyPageSchema.statics.executeQueryTable = function (idapp, params) {
|
MyPageSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
255
src/server/models/nave.js
Normal file → Executable file
255
src/server/models/nave.js
Normal file → Executable file
@@ -45,6 +45,9 @@ const NaveSchema = new mongoose.Schema({
|
|||||||
date_start: {
|
date_start: {
|
||||||
type: Date
|
type: Date
|
||||||
},
|
},
|
||||||
|
date_gift_chat_open: {
|
||||||
|
type: Date
|
||||||
|
},
|
||||||
link_chat: {
|
link_chat: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -72,6 +75,9 @@ const NaveSchema = new mongoose.Schema({
|
|||||||
num_tess: { // numero di tessitura
|
num_tess: { // numero di tessitura
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1
|
||||||
|
},
|
||||||
|
provvisoria: {
|
||||||
|
type: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -121,7 +127,8 @@ NaveSchema.statics.findByIndPrimario = function (idapp, indprimario) {
|
|||||||
|
|
||||||
|
|
||||||
NaveSchema.statics.getFieldsForSearch = function () {
|
NaveSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['username', 'name', 'surname', 'ind_order']
|
return [{ field: 'ind_order', type: tools.FieldType.number },
|
||||||
|
{ field: 'col', type: tools.FieldType.number }]
|
||||||
};
|
};
|
||||||
|
|
||||||
NaveSchema.statics.executeQueryTable = function (idapp, params) {
|
NaveSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -187,13 +194,16 @@ function getIndColonneByNave(navemediatore) {
|
|||||||
let col = navemediatore.col;
|
let col = navemediatore.col;
|
||||||
|
|
||||||
let col_ini = calcval(riga, col, 8) + 1;
|
let col_ini = calcval(riga, col, 8) + 1;
|
||||||
let col_fine = col_ini + 8;
|
let col_fine = col_ini + 7;
|
||||||
|
|
||||||
return { riga: riga + 3, col_ini, col_fine }
|
return { riga: riga + 3, col_ini, col_fine }
|
||||||
}
|
}
|
||||||
|
|
||||||
NaveSchema.statics.getusersByNave = function (idapp, navemediatore) {
|
NaveSchema.statics.getusersByNave = function (idapp, navemediatore) {
|
||||||
|
|
||||||
|
if ((!navemediatore.riga) || (!navemediatore.col))
|
||||||
|
return [];
|
||||||
|
|
||||||
const obj = getIndColonneByNave(navemediatore);
|
const obj = getIndColonneByNave(navemediatore);
|
||||||
|
|
||||||
const miacol_ini = obj.col_ini;
|
const miacol_ini = obj.col_ini;
|
||||||
@@ -248,7 +258,8 @@ NaveSchema.statics.findRecByRigaColParent = async function (idapp, riga, col, nu
|
|||||||
myrigacol.riga = lastrec.riga;
|
myrigacol.riga = lastrec.riga;
|
||||||
myrigacol.col = lastrec.col;
|
myrigacol.col = lastrec.col;
|
||||||
} else {
|
} else {
|
||||||
lastrec = await User.findByIndOrder(idapp, 0);
|
//lastrec = await User.findByIndOrder(idapp, 0);
|
||||||
|
lastrec = await Nave.findGeneric({ idapp, riga: 0, col: 0 });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,7 +268,8 @@ NaveSchema.statics.findRecByRigaColParent = async function (idapp, riga, col, nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!lastrec) {
|
if (!lastrec) {
|
||||||
return await User.findByIndOrder(idapp, 0);
|
// return await User.findByIndOrder(idapp, 0);
|
||||||
|
return await Nave.findGeneric({ idapp, riga: 0, col: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastrec;
|
return lastrec;
|
||||||
@@ -278,14 +290,6 @@ function getlimiti(mypos) {
|
|||||||
return mypos;
|
return mypos;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRigaColByPosUp(mypos) {
|
|
||||||
mypos.riga = mypos.riga - mypos.numup;
|
|
||||||
mypos.col = Math.floor(mypos.col / (Math.pow(2, mypos.numup)));
|
|
||||||
// if ((mypos.col % 2) !== 0)
|
|
||||||
// mypos.col++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRigaColGenerica(idapp, riga, col, numup) {
|
function getRigaColGenerica(idapp, riga, col, numup) {
|
||||||
mypos = {
|
mypos = {
|
||||||
idapp,
|
idapp,
|
||||||
@@ -295,7 +299,7 @@ function getRigaColGenerica(idapp, riga, col, numup) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (idapp === tools.AYNI) {
|
if (idapp === tools.AYNI) {
|
||||||
getRigaColByPosUp(mypos);
|
tools.getRigaColByPosUp(mypos);
|
||||||
ris = getlimiti(mypos);
|
ris = getlimiti(mypos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,22 +399,26 @@ NaveSchema.statics.findMediatoreByFuoco = async function (idapp, riga, col, offs
|
|||||||
// return Nave.findGeneric(myrigacol);
|
// return Nave.findGeneric(myrigacol);
|
||||||
return await Nave.findRecByRigaColParent(idapp, riga, col, 3 - offset);
|
return await Nave.findRecByRigaColParent(idapp, riga, col, 3 - offset);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getQueryProj(myfilter) {
|
function getQueryProj(myfilter) {
|
||||||
|
|
||||||
myobjField = {
|
myobjField = {
|
||||||
_id: 1,
|
_id: 1,
|
||||||
|
idapp: 1,
|
||||||
lang: 1,
|
lang: 1,
|
||||||
ind_order: 1,
|
ind_order: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
username: 1,
|
username: 1,
|
||||||
|
'profile.paymenttypes': 1,
|
||||||
|
'profile.email_paypal': 1,
|
||||||
date_start: 1,
|
date_start: 1,
|
||||||
|
date_gift_chat_open: 1,
|
||||||
made_gift: 1,
|
made_gift: 1,
|
||||||
link_chat: 1,
|
link_chat: 1,
|
||||||
date_made_gift: 1,
|
date_made_gift: 1,
|
||||||
|
provvisoria: 1,
|
||||||
received_gift: 1,
|
received_gift: 1,
|
||||||
date_received_gift: 1,
|
date_received_gift: 1,
|
||||||
num_tess: 1,
|
num_tess: 1,
|
||||||
@@ -464,7 +472,11 @@ function getmaxcol(riga) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPrimoFuocoByIndCol(col) {
|
function getPrimoFuocoByIndCol(col) {
|
||||||
return Math.floor(col - (col % 8)) + 1;
|
// let ris = Math.ceil(col - (col % 8)) + 1;
|
||||||
|
let ris = ((Math.ceil(col / 8) - 1) * 8) + 1;
|
||||||
|
if (ris <= 0)
|
||||||
|
ris = 1;
|
||||||
|
return ris
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getusertextbyrec(myrec, symbol, lettera, riga, col, ind) {
|
async function getusertextbyrec(myrec, symbol, lettera, riga, col, ind) {
|
||||||
@@ -480,12 +492,26 @@ async function getusertextbyrec(myrec, symbol, lettera, riga, col, ind) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (myrec)
|
if (myrec)
|
||||||
return lettera + ind + ' - ' + symbol + '[' + miariga + ',' + miacol + ']' + ' ' + myrec.name + ' ' + myrec.surname + '';
|
return lettera + ind + ' - ' + symbol + '[' + riga + ',' + col + ']' + ' ' + myrec.name + ' ' + myrec.surname + '';
|
||||||
else
|
else
|
||||||
return lettera + ind + ' - ' + symbol;
|
return lettera + ind + ' - ' + symbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkifNullThenEmpty(rec, riga, col) {
|
||||||
|
if (rec === null) {
|
||||||
|
return {
|
||||||
|
name: '',
|
||||||
|
surname: '',
|
||||||
|
username: '',
|
||||||
|
riga,
|
||||||
|
col,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset, solorecord) {
|
NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset, solorecord) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
|
|
||||||
@@ -526,17 +552,25 @@ NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset,
|
|||||||
// mystr += '🔥🌏💦💨🔥🌏💦💨' + tools.ACAPO;
|
// mystr += '🔥🌏💦💨🔥🌏💦💨' + tools.ACAPO;
|
||||||
|
|
||||||
let arrdonatori = [];
|
let arrdonatori = [];
|
||||||
|
// let numcol = Math.pow(2, indriga - 1);
|
||||||
|
primofuoco = getPrimoFuocoByIndCol(col * Math.pow(2, offset));
|
||||||
|
|
||||||
let ind = 1;
|
let ind = 1;
|
||||||
for (let indcol = primofuoco; indcol < primofuoco + 8; indcol++) {
|
for (let indcol = primofuoco; indcol < primofuoco + 8; indcol++) {
|
||||||
let indr = riga + offset;
|
let indr = riga + offset;
|
||||||
let indc = indcol + (offset * indr);
|
let indc = indcol + (offset * indr);
|
||||||
|
|
||||||
indr = riga + offset;
|
indr = riga + offset;
|
||||||
indc = calcval(riga, col, 8) + (indcol - primofuoco + 1);
|
// indc = calcval(riga, col, 8) + (indcol - primofuoco + 1);
|
||||||
|
if (offset === 0)
|
||||||
|
indc = indcol;
|
||||||
|
else
|
||||||
|
indc = indcol;
|
||||||
// miacol = calcval(riga, col, 8) + (indfuoco);
|
// miacol = calcval(riga, col, 8) + (indfuoco);
|
||||||
|
|
||||||
|
|
||||||
let recfuoco = await Nave.findByRigaCol(idapp, indr, indc, true);
|
let recfuoco = await Nave.findByRigaCol(idapp, indr, indc, true);
|
||||||
|
recfuoco = checkifNullThenEmpty(recfuoco, indr, indc);
|
||||||
arrdonatori.push(recfuoco);
|
arrdonatori.push(recfuoco);
|
||||||
mystr += await getusertextbyrec(recfuoco, symb.icona, symb.car, indr, indc, ind) + tools.ACAPO;
|
mystr += await getusertextbyrec(recfuoco, symb.icona, symb.car, indr, indc, ind) + tools.ACAPO;
|
||||||
ind++;
|
ind++;
|
||||||
@@ -560,14 +594,63 @@ NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NaveSchema.statics.getPlaccaPerDonatore = async function (idapp, riga, col, solorecord) {
|
NaveSchema.statics.getPlaccaPerDonatore = async function (idapp, riga, col, solorecord, rec) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
return Nave.getPlaccaGenerica(idapp, riga, col, tools.Placca.SONOFUOCO, solorecord);
|
|
||||||
|
if (solorecord) {
|
||||||
|
|
||||||
|
rec.donatore = await Nave.getPlaccaGenerica(idapp, riga, col, tools.Placca.SONOFUOCO, solorecord);
|
||||||
|
newcol = Math.ceil(col / (Math.pow(2, 3)));
|
||||||
|
rec.donatore.arrterra = await Nave.getArrTerra(idapp, riga - 3, newcol);
|
||||||
|
rec.donatore.arraria = await Nave.getArrAria(idapp, riga - 3, newcol);
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
} else {
|
||||||
|
return await Nave.getPlaccaGenerica(idapp, riga, col, tools.Placca.SONOFUOCO, solorecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NaveSchema.statics.getPlaccaPerMediatore = async function (idapp, riga, col, solorecord) {
|
NaveSchema.statics.getPlaccaPerMediatore = async function (idapp, riga, col, solorecord, rec) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
return Nave.getPlaccaGenerica(idapp, riga, col, tools.Placca.SONOACQUA, solorecord);
|
rec.mediatore = await Nave.getPlaccaGenerica(idapp, riga, col, tools.Placca.SONOACQUA, solorecord);
|
||||||
|
|
||||||
|
rec.mediatore.arrterra = await Nave.getArrTerra(idapp, riga, col);
|
||||||
|
rec.mediatore.arraria = await Nave.getArrAria(idapp, riga, col);
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
};
|
||||||
|
|
||||||
|
NaveSchema.statics.getArrTerra = async function (idapp, riga, col) {
|
||||||
|
const Nave = this;
|
||||||
|
|
||||||
|
let arrterra = [];
|
||||||
|
for (let indterra = 1; indterra <= 2; indterra++) {
|
||||||
|
miacol = calcval(riga, col, 2) + (indterra);
|
||||||
|
miariga = riga + 1;
|
||||||
|
let rec = await Nave.findByRigaCol(idapp, miariga, miacol, true);
|
||||||
|
rec = checkifNullThenEmpty(rec, miariga, miacol);
|
||||||
|
arrterra.push(rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrterra;
|
||||||
|
};
|
||||||
|
|
||||||
|
NaveSchema.statics.getArrAria = async function (idapp, riga, col) {
|
||||||
|
const Nave = this;
|
||||||
|
|
||||||
|
let arraria = [];
|
||||||
|
for (let indaria = 1; indaria <= 4; indaria++) {
|
||||||
|
miacol = calcval(riga, col, 4) + (indaria);
|
||||||
|
miariga = riga + 2;
|
||||||
|
let rec = await Nave.findByRigaCol(idapp, miariga, miacol, true);
|
||||||
|
rec = checkifNullThenEmpty(rec, miariga, miacol);
|
||||||
|
arraria.push(rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arraria;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function calcval(riga, col, quanti) {
|
function calcval(riga, col, quanti) {
|
||||||
@@ -624,12 +707,21 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let data = "";
|
let data = "";
|
||||||
if (primofuoco)
|
let mystrtemp = '';
|
||||||
data = "Partenza il " + tools.getstrDateLong(primofuoco.date_start) + tools.ACAPO;
|
if (primofuoco) {
|
||||||
else
|
data = '💬 Giorno di Apertura GIFT CHAT: ' + tools.getstrDateLong(primofuoco.date_gift_chat_open) + tools.ACAPO;
|
||||||
|
data += "🎁 Giorno in cui Inviare il DONO : " + tools.getstrDateLong(primofuoco.date_start) + tools.ACAPO;
|
||||||
|
data += tools.ACAPO;
|
||||||
|
|
||||||
|
data += 'Il Mediatore sarà contattato 1 giorno prima dal Tutor' + tools.ACAPO;
|
||||||
|
|
||||||
|
if (primofuoco.provvisoria)
|
||||||
|
mystrtemp = 'TEMPORANEA ';
|
||||||
|
} else
|
||||||
data = "";
|
data = "";
|
||||||
|
|
||||||
mystr = tools.ACAPO + 'NAVE (' + riga + '.' + col + ') ' + tools.ACAPO + data + tools.ACAPO + mystr;
|
|
||||||
|
mystr = tools.ACAPO + 'NAVE ' + '[' + riga + '.' + col + '] ' + mystrtemp + tools.ACAPO + data + tools.ACAPO + mystr;
|
||||||
|
|
||||||
return mystr;
|
return mystr;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -679,7 +771,7 @@ NaveSchema.statics.getArrPosizioniByIndOrder = async function (idapp, ind_order)
|
|||||||
NaveSchema.statics.getPrimaNaveByRiga = async function (idapp, riga) {
|
NaveSchema.statics.getPrimaNaveByRiga = async function (idapp, riga) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
|
|
||||||
nave = await Nave.find({ 'idapp': idapp, riga: (riga + 3), col: 1 });
|
nave = await Nave.findOne({ 'idapp': idapp, riga: (riga + 3), col: 1 });
|
||||||
|
|
||||||
return nave;
|
return nave;
|
||||||
};
|
};
|
||||||
@@ -702,12 +794,20 @@ NaveSchema.statics.showListaOrd = async function (idapp) {
|
|||||||
return mystr;
|
return mystr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NaveSchema.statics.getLastRigaCol = async function (idapp) {
|
||||||
|
return Nave.findOne({ idapp }).sort({ _id: -1 });
|
||||||
|
};
|
||||||
|
|
||||||
async function addRecordNaveByParams(params, siRitesse) {
|
async function addRecordNaveByParams(params, siRitesse) {
|
||||||
const { ListaIngresso } = require('./listaingresso');
|
const { ListaIngresso } = require('./listaingresso');
|
||||||
|
|
||||||
if (!siRitesse) {
|
if (!siRitesse) {
|
||||||
// Check if Exist:
|
// Check if Exist:
|
||||||
const giapresente = await Nave.findOne({ idapp: params.idapp, ind_order: params.ind_order, num_tess: params.num_tess });
|
const giapresente = await Nave.findOne({
|
||||||
|
idapp: params.idapp,
|
||||||
|
ind_order: params.ind_order,
|
||||||
|
num_tess: params.num_tess
|
||||||
|
});
|
||||||
if (!!giapresente) {
|
if (!!giapresente) {
|
||||||
let fields_to_update = { added: true };
|
let fields_to_update = { added: true };
|
||||||
await ListaIngresso.findOneAndUpdate({ _id: params.id.toString() }, { $set: fields_to_update }, { new: false });
|
await ListaIngresso.findOneAndUpdate({ _id: params.id.toString() }, { $set: fields_to_update }, { new: false });
|
||||||
@@ -724,7 +824,9 @@ async function addRecordNaveByParams(params, siRitesse) {
|
|||||||
riga: params.riga,
|
riga: params.riga,
|
||||||
col: params.col,
|
col: params.col,
|
||||||
date_start: params.date_start,
|
date_start: params.date_start,
|
||||||
|
date_gift_chat_open: params.date_gift_chat_open,
|
||||||
num_tess: params.num_tess,
|
num_tess: params.num_tess,
|
||||||
|
provvisoria: params.provvisoria,
|
||||||
});
|
});
|
||||||
myNave.created = new Date();
|
myNave.created = new Date();
|
||||||
|
|
||||||
@@ -834,10 +936,13 @@ NaveSchema.statics.addUserFromListaIngresso_IntoNave = async function (init, ida
|
|||||||
let recmediatore = await Nave.findMediatoreByFuoco(idapp, myriga, mycol, 0);
|
let recmediatore = await Nave.findMediatoreByFuoco(idapp, myriga, mycol, 0);
|
||||||
if (!!recmediatore) {
|
if (!!recmediatore) {
|
||||||
const ris = await Nave.checkifDeveRitessersi(recmediatore);
|
const ris = await Nave.checkifDeveRitessersi(recmediatore);
|
||||||
if (ris.num_tess > 2) {
|
if (ris.num_tess >= 2) {
|
||||||
console.log('E\' arrivato alla TERZA RITESSITURA, PERTANTO LO METTIAMO IN CODA... [riga=', params.riga, 'col', params.col, '] indorder=' + recmediatore.ind_order);
|
console.log('E\' arrivato alla TERZA RITESSITURA, PERTANTO LO METTIAMO IN CODA... [riga=', params.riga, 'col', params.col, '] indorder=' + recmediatore.ind_order);
|
||||||
// E' arrivato alla TERZA RITESSITURA, PERTANTO LO METTIAMO IN CODA...
|
// E' arrivato alla TERZA RITESSITURA, PERTANTO LO METTIAMO IN CODA...
|
||||||
const risultato = await ListaIngresso.addUserInListaIngresso(idapp, recmediatore.ind_order, rec.lang, false, ris.num_tess);
|
|
||||||
|
//++Todo: TESSITURA????
|
||||||
|
|
||||||
|
//const risultato = await ListaIngresso.addUserInListaIngresso(idapp, recmediatore.ind_order, rec.lang, false, ris.num_tess);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Si deve ritessere: [riga=', params.riga, 'col', params.col, ']');
|
console.log('Si deve ritessere: [riga=', params.riga, 'col', params.col, ']');
|
||||||
@@ -883,6 +988,7 @@ NaveSchema.statics.generaNave = async function (idapp, mydata) {
|
|||||||
riga: await Nave.getRiga(idapp),
|
riga: await Nave.getRiga(idapp),
|
||||||
col: await Nave.getCol(idapp),
|
col: await Nave.getCol(idapp),
|
||||||
date_start: mydata.date_start,
|
date_start: mydata.date_start,
|
||||||
|
date_gift_chat_open: tools.AddDate(mydata.date_start, -7),
|
||||||
numpersone: mydata.numpersone,
|
numpersone: mydata.numpersone,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -912,6 +1018,7 @@ NaveSchema.statics.generaNave = async function (idapp, mydata) {
|
|||||||
params.ind_order = reclista.ind_order;
|
params.ind_order = reclista.ind_order;
|
||||||
params.id = reclista._id;
|
params.id = reclista._id;
|
||||||
params.num_tess = reclista.num_tess;
|
params.num_tess = reclista.num_tess;
|
||||||
|
params.provvisoria = mydata.provvisoria;
|
||||||
|
|
||||||
await Nave.addUserFromListaIngresso_IntoNave(index === 0, idapp, params, false);
|
await Nave.addUserFromListaIngresso_IntoNave(index === 0, idapp, params, false);
|
||||||
index++;
|
index++;
|
||||||
@@ -932,6 +1039,7 @@ async function addUserToNave(idapp, rec) {
|
|||||||
params.ind_order = rec.ind_order;
|
params.ind_order = rec.ind_order;
|
||||||
params.id = rec._id;
|
params.id = rec._id;
|
||||||
params.num_tess = rec.num_tess;
|
params.num_tess = rec.num_tess;
|
||||||
|
params.provvisoria = false;
|
||||||
|
|
||||||
return await Nave.addUserFromListaIngresso_IntoNave(true, idapp, params, true);
|
return await Nave.addUserFromListaIngresso_IntoNave(true, idapp, params, true);
|
||||||
|
|
||||||
@@ -952,16 +1060,48 @@ NaveSchema.statics.checkIfDevoAggiungereInNave = async function (idapp) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NaveSchema.statics.pulisciNonPresenzeInNave = async function (idapp) {
|
||||||
|
const Nave = this;
|
||||||
|
|
||||||
|
let numrec = 0;
|
||||||
|
|
||||||
|
const { ListaIngresso } = require('./listaingresso');
|
||||||
|
|
||||||
|
const myquery = getQueryProj({
|
||||||
|
idapp,
|
||||||
|
ind_order: { $gt: 0 },
|
||||||
|
added: true,
|
||||||
|
deleted: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
arrrec = await ListaIngresso.aggregate(myquery)
|
||||||
|
.then(async (arrlista) => {
|
||||||
|
for (const rec of arrlista) {
|
||||||
|
const trovato = await Nave.findByIndOrder(idapp, rec.ind_order);
|
||||||
|
if (!trovato) {
|
||||||
|
let fields_to_update = { added: false };
|
||||||
|
await ListaIngresso.findOneAndUpdate({ _id: rec._id }, { $set: fields_to_update }, { new: false });
|
||||||
|
numrec++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return numrec;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
NaveSchema.statics.getNaveByUser = async function (idapp, ind_order, lang, fuoco) {
|
NaveSchema.statics.getNaveByUser = async function (idapp, ind_order, lang, fuoco) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
|
|
||||||
let mystr = '';
|
let mystr = '';
|
||||||
|
let rec = {};
|
||||||
const arrposiz = await Nave.getArrPosizioniByIndOrder(idapp, ind_order);
|
const arrposiz = await Nave.getArrPosizioniByIndOrder(idapp, ind_order);
|
||||||
if (!!arrposiz) {
|
if (!!arrposiz) {
|
||||||
for (const pos of arrposiz) {
|
for (const pos of arrposiz) {
|
||||||
mystr += await Nave.getNavePos(idapp, pos.riga - 3, Math.floor(pos.col / (2 * 4)), false);
|
mystr += await Nave.getNavePos(idapp, pos.riga - 3, Math.floor(pos.col / (2 * 4)), false);
|
||||||
mystr += await Nave.getPlaccaPerDonatore(idapp, pos.riga, pos.col, false);
|
mystr += await Nave.getPlaccaPerDonatore(idapp, pos.riga, pos.col, false, rec);
|
||||||
mystr += await Nave.getPlaccaPerMediatore(idapp, pos.riga, pos.col, false);
|
mystr += await Nave.getPlaccaPerMediatore(idapp, pos.riga, pos.col, false, rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,20 +1112,65 @@ NaveSchema.statics.getNaveByUser = async function (idapp, ind_order, lang, fuoco
|
|||||||
return mystr;
|
return mystr;
|
||||||
};
|
};
|
||||||
|
|
||||||
NaveSchema.statics.getNaveByRigaCol = async function (idapp, riga, col) {
|
NaveSchema.statics.getNaveByRigaCol = async function (idapp, riganave, colnave) {
|
||||||
const Nave = this;
|
const Nave = this;
|
||||||
|
|
||||||
|
const rigaprec = riganave;
|
||||||
|
|
||||||
rec = {};
|
rec = {};
|
||||||
rec.donatore = await Nave.getPlaccaPerDonatore(idapp, riga, col, true);
|
rec = await Nave.getPlaccaPerMediatore(idapp, riganave, colnave, true, rec);
|
||||||
rec.mediatore = await Nave.getPlaccaPerMediatore(idapp, riga, col, true);
|
|
||||||
|
if (riganave < 4) {
|
||||||
|
riganave = 4;
|
||||||
|
colnave = 1;
|
||||||
|
}
|
||||||
|
rec = await Nave.getPlaccaPerDonatore(idapp, riganave, colnave, true, rec);
|
||||||
|
|
||||||
return rec;
|
return rec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NaveSchema.statics.getDonatoridelSognatore = async function (idapp, riganave, colnave) {
|
||||||
|
const Nave = this;
|
||||||
|
|
||||||
|
coldonatoreIni = calcval(riganave, colnave, 8) + (1);
|
||||||
|
coldonatoreFine = calcval(riganave, colnave, 8) + (64);
|
||||||
|
|
||||||
|
const myquery = getQueryProj({
|
||||||
|
idapp,
|
||||||
|
riga: riganave + 6,
|
||||||
|
col: { $gte: coldonatoreIni, $lte: coldonatoreFine }
|
||||||
|
});
|
||||||
|
|
||||||
|
const arrnaviout = [];
|
||||||
|
|
||||||
|
const arrnavi = await Nave.aggregate(myquery);
|
||||||
|
|
||||||
|
for (const nave of arrnavi) {
|
||||||
|
// Se è il mediatore, allora non includerlo nei Donatori!
|
||||||
|
mypos = {
|
||||||
|
riga: nave.riga,
|
||||||
|
col: nave.col,
|
||||||
|
numup: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
tools.getRigaColByPosUp(mypos);
|
||||||
|
|
||||||
|
const navemediatore = await Nave.findByRigaCol(idapp, mypos.riga, mypos.col, true);
|
||||||
|
if (!!navemediatore) {
|
||||||
|
if (navemediatore.ind_order !== nave.ind_order) {
|
||||||
|
arrnaviout.push(nave);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
arrnaviout.push(nave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arrnaviout;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
const Nave = mongoose.model('Nave', NaveSchema);
|
const Nave = mongoose.model('Nave', NaveSchema);
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Nave };
|
module.exports = { Nave };
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
src/server/models/newstosent.js
Normal file → Executable file
5
src/server/models/newstosent.js
Normal file → Executable file
@@ -64,7 +64,9 @@ const NewstosentSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
NewstosentSchema.statics.getFieldsForSearch = function () {
|
NewstosentSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['name', 'surname', 'email']
|
return [{ field: 'name', type: tools.FieldType.string },
|
||||||
|
{ field: 'surname', type: tools.FieldType.string },
|
||||||
|
{ field: 'email', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
NewstosentSchema.statics.executeQueryTable = function (idapp, params) {
|
NewstosentSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -166,7 +168,6 @@ NewstosentSchema.statics.isActivated = async function (_id) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
|
const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
|
||||||
|
|
||||||
module.exports = { Newstosent };
|
module.exports = { Newstosent };
|
||||||
|
|||||||
5
src/server/models/operator.js
Normal file → Executable file
5
src/server/models/operator.js
Normal file → Executable file
@@ -85,7 +85,10 @@ OperatorSchema.statics.getEmailByUsername = async function (idapp, username) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
OperatorSchema.statics.getFieldsForSearch = function () {
|
OperatorSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['name', 'surname', 'email', 'cell']
|
return [{ field: 'name', type: tools.FieldType.string },
|
||||||
|
{ field: 'surname', type: tools.FieldType.string },
|
||||||
|
{ field: 'email', type: tools.FieldType.string },
|
||||||
|
{ field: 'cell', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
src/server/models/opzemail.js
Normal file → Executable file
2
src/server/models/opzemail.js
Normal file → Executable file
@@ -24,7 +24,7 @@ const OpzEmailSchema = new Schema({
|
|||||||
|
|
||||||
|
|
||||||
OpzEmailSchema.statics.getFieldsForSearch = function () {
|
OpzEmailSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['label_it']
|
return [{field: 'label_it', type: tools.FieldType.string}]
|
||||||
};
|
};
|
||||||
|
|
||||||
OpzEmailSchema.statics.executeQueryTable = function (idapp, params) {
|
OpzEmailSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
2
src/server/models/paymenttype.js
Normal file → Executable file
2
src/server/models/paymenttype.js
Normal file → Executable file
@@ -25,7 +25,7 @@ const PaymentTypeSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
PaymentTypeSchema.statics.getFieldsForSearch = function () {
|
PaymentTypeSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['label']
|
return [{field: 'label', type: tools.FieldType.string}]
|
||||||
};
|
};
|
||||||
|
|
||||||
PaymentTypeSchema.statics.executeQueryTable = function (idapp, params) {
|
PaymentTypeSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
0
src/server/models/permission.js
Normal file → Executable file
0
src/server/models/permission.js
Normal file → Executable file
0
src/server/models/project.js
Normal file → Executable file
0
src/server/models/project.js
Normal file → Executable file
0
src/server/models/sendmsg.js
Normal file → Executable file
0
src/server/models/sendmsg.js
Normal file → Executable file
9
src/server/models/settings.js
Normal file → Executable file
9
src/server/models/settings.js
Normal file → Executable file
@@ -43,7 +43,8 @@ const SettingsSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
SettingsSchema.statics.getFieldsForSearch = function () {
|
SettingsSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['key', 'value_str']
|
return [{ field: 'key', type: tools.FieldType.string },
|
||||||
|
{ field: 'value_str', type: tools.FieldType.string }, { field: 'value_num', type: tools.FieldType.number }]
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsSchema.statics.executeQueryTable = function (idapp, params) {
|
SettingsSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -108,7 +109,7 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
|||||||
|
|
||||||
return await myrec.save();
|
return await myrec.save();
|
||||||
} else {
|
} else {
|
||||||
myrec = await Settings.findOneAndUpdate({ idapp, key }, { $set: { value_num: value } }, { new: false});
|
myrec = await Settings.findOneAndUpdate({ idapp, key }, { $set: { value_num: value } }, { new: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -117,7 +118,7 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
|||||||
SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
|
SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
|
||||||
const Settings = this;
|
const Settings = this;
|
||||||
|
|
||||||
const ret = await Settings.findOne({ idapp, key});
|
const ret = await Settings.findOne({ idapp, key });
|
||||||
if (!!ret) {
|
if (!!ret) {
|
||||||
return ret.value_num;
|
return ret.value_num;
|
||||||
} else {
|
} else {
|
||||||
@@ -126,6 +127,6 @@ SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Settings = mongoose.model('Settings', SettingsSchema);
|
const Settings = mongoose.model('Settings', SettingsSchema);
|
||||||
|
|
||||||
module.exports = { Settings };
|
module.exports = { Settings };
|
||||||
|
|||||||
0
src/server/models/subscribers.js
Normal file → Executable file
0
src/server/models/subscribers.js
Normal file → Executable file
2
src/server/models/templemail.js
Normal file → Executable file
2
src/server/models/templemail.js
Normal file → Executable file
@@ -41,7 +41,7 @@ const TemplEmailSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
TemplEmailSchema.statics.getFieldsForSearch = function () {
|
TemplEmailSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['']
|
return []
|
||||||
};
|
};
|
||||||
|
|
||||||
TemplEmailSchema.statics.executeQueryTable = function (idapp, params) {
|
TemplEmailSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
|
|||||||
0
src/server/models/todo.js
Normal file → Executable file
0
src/server/models/todo.js
Normal file → Executable file
19
src/server/models/user.js
Normal file → Executable file
19
src/server/models/user.js
Normal file → Executable file
@@ -800,6 +800,7 @@ UserSchema.statics.getSmallRecByIndOrder = async function (idapp, ind_order) {
|
|||||||
|
|
||||||
return await User.findOne({ idapp, ind_order },
|
return await User.findOne({ idapp, ind_order },
|
||||||
{
|
{
|
||||||
|
idapp: 1,
|
||||||
ind_order: 1,
|
ind_order: 1,
|
||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
@@ -929,7 +930,15 @@ UserSchema.statics.getUsersListByParams = function (params) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
UserSchema.statics.getFieldsForSearch = function () {
|
UserSchema.statics.getFieldsForSearch = function () {
|
||||||
return ['username', 'name', 'surname', 'email', 'profile.cell', 'profile.email_paypal', 'profile.username_telegram', 'aportador_solidario']
|
return [{field: 'username', type: tools.FieldType.string},
|
||||||
|
{filed: 'name', type: tools.FieldType.string },
|
||||||
|
{filed: 'ind_order', type: tools.FieldType.number },
|
||||||
|
{field: 'surname', type: tools.FieldType.string },
|
||||||
|
{field: 'email', type: tools.FieldType.string },
|
||||||
|
{field: 'profile.cell', type: tools.FieldType.string},
|
||||||
|
{field: 'profile.email_paypal', type: tools.FieldType.string},
|
||||||
|
{field: 'profile.username_telegram', type: tools.FieldType.string},
|
||||||
|
{field: 'aportador_solidario', type: tools.FieldType.string}]
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.executeQueryTable = function (idapp, params) {
|
UserSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -998,8 +1007,11 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
|
|||||||
|
|
||||||
for (let mynave of dashboard.arrnavi) {
|
for (let mynave of dashboard.arrnavi) {
|
||||||
mynave._doc.rec = await Nave.getNaveByRigaCol(idapp, mynave.riga, mynave.col);
|
mynave._doc.rec = await Nave.getNaveByRigaCol(idapp, mynave.riga, mynave.col);
|
||||||
|
mynave._doc.listadonatoridelsognatore = await Nave.getDonatoridelSognatore(idapp, mynave.riga, mynave.col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.table(dashboard.arrnavi);
|
||||||
|
|
||||||
return dashboard;
|
return dashboard;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -1303,12 +1315,7 @@ async function addUtentiInLista(idapp, mode, arrusers) {
|
|||||||
} else if (mode === 4) {
|
} else if (mode === 4) {
|
||||||
ok = qualified && (numinvitati === 1);
|
ok = qualified && (numinvitati === 1);
|
||||||
} else if (mode === 5) {
|
} else if (mode === 5) {
|
||||||
// 7 punti qualificati
|
|
||||||
ok = qualified;
|
ok = qualified;
|
||||||
// // almeno telegram ID
|
|
||||||
// ok = user.profile.teleg_id > 0;
|
|
||||||
// } else {
|
|
||||||
// ok = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user