Lista Doni Navi
This commit is contained in:
@@ -53,7 +53,7 @@ CalZoomSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const myfind = { idapp, date_start: { $gt: tools.IncDateNow(-1000 * 60 * 60 * 3) } };
|
||||
|
||||
return await CalZoom.find(myfind).sort({ date_start: 1 }).limit(4);
|
||||
return await CalZoom.find(myfind).sort({ date_start: 1 }).limit(6);
|
||||
};
|
||||
|
||||
CalZoomSchema.statics.getNextZoom = async function (idapp) {
|
||||
|
||||
@@ -78,8 +78,13 @@ const NaveSchema = new mongoose.Schema({
|
||||
},
|
||||
provvisoria: {
|
||||
type: Boolean
|
||||
},
|
||||
note: {
|
||||
type: String
|
||||
},
|
||||
note_interne: {
|
||||
type: String
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NaveSchema.statics.getTotInLista = async function (idapp) {
|
||||
@@ -354,11 +359,12 @@ NaveSchema.statics.findGeneric = function (myrigacol) {
|
||||
return myarr;
|
||||
} else {
|
||||
let myarr = null;
|
||||
if (rec[0]._doc === undefined)
|
||||
myarr = { ...newrec._doc, ...rec[0] };
|
||||
else
|
||||
myarr = { ...newrec._doc, ...rec[0]._doc };
|
||||
|
||||
if (!!newrec) {
|
||||
if (rec[0]._doc === undefined)
|
||||
myarr = { ...newrec._doc, ...rec[0] };
|
||||
else
|
||||
myarr = { ...newrec._doc, ...rec[0]._doc };
|
||||
}
|
||||
return myarr;
|
||||
}
|
||||
} else {
|
||||
@@ -417,8 +423,11 @@ function getQueryProj(myfilter) {
|
||||
date_gift_chat_open: 1,
|
||||
made_gift: 1,
|
||||
link_chat: 1,
|
||||
sent_msg_howto_make_gift: 1,
|
||||
date_made_gift: 1,
|
||||
provvisoria: 1,
|
||||
note: 1,
|
||||
note_interne: 1,
|
||||
received_gift: 1,
|
||||
date_received_gift: 1,
|
||||
num_tess: 1,
|
||||
@@ -571,7 +580,7 @@ NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset,
|
||||
|
||||
let recfuoco = await Nave.findByRigaCol(idapp, indr, indc, true);
|
||||
recfuoco = checkifNullThenEmpty(recfuoco, indr, indc);
|
||||
arrdonatori.push(recfuoco);
|
||||
arrdonatori.push({ index: ind, ...recfuoco });
|
||||
mystr += await getusertextbyrec(recfuoco, symb.icona, symb.car, indr, indc, ind) + tools.ACAPO;
|
||||
ind++;
|
||||
}
|
||||
@@ -660,6 +669,12 @@ function calcval(riga, col, quanti) {
|
||||
NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
||||
const Nave = this;
|
||||
|
||||
if (riga <= 0)
|
||||
riga = 1;
|
||||
if (col <= 0)
|
||||
col = 1;
|
||||
|
||||
|
||||
try {
|
||||
let recsognatori = [await Nave.findRecByRigaColParent(idapp, riga, col, 3),
|
||||
await Nave.findRecByRigaColParent(idapp, riga, col, 2),
|
||||
@@ -696,6 +711,9 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
||||
let primofuoco = null;
|
||||
|
||||
mystr += '🎁 DONATORI:' + tools.ACAPO;
|
||||
let donitotali = 0;
|
||||
let donifatti = 0;
|
||||
|
||||
for (let indfuoco = 1; indfuoco <= 8; indfuoco++) {
|
||||
miacol = calcval(riga, col, 8) + (indfuoco);
|
||||
miariga = riga + 3;
|
||||
@@ -703,7 +721,26 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
||||
let recfuoco = await Nave.findByRigaCol(idapp, miariga, miacol, true);
|
||||
if (indfuoco === 1)
|
||||
primofuoco = recfuoco;
|
||||
mystr += await getusertextbyrec(recfuoco, '', 'D', miariga, miacol, indfuoco) + tools.ACAPO;
|
||||
|
||||
let symbol = '';
|
||||
if (recfuoco.made_gift) {
|
||||
symbol = '🎁';
|
||||
donifatti++;
|
||||
}
|
||||
if (!!recfuoco && recmediatore) {
|
||||
if (recfuoco.ind_order === recmediatore.ind_order && recfuoco.num_tess === 2) {
|
||||
mystr += await getusertextbyrec(recfuoco, '', 'TESS', miariga, miacol, '') + tools.ACAPO;
|
||||
} else {
|
||||
mystr += await getusertextbyrec(recfuoco, symbol, 'D', miariga, miacol, indfuoco) + tools.ACAPO;
|
||||
donitotali++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (donitotali > 0 && donifatti >= donitotali) {
|
||||
mystr += tools.ACAPO + '💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫' + tools.ACAPO +
|
||||
'✨✨✨ NAVE COMPLETATA (Doni Effettuati) ! ✨✨✨' + tools.ACAPO +
|
||||
'💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫💫' + tools.ACAPO;
|
||||
}
|
||||
|
||||
let data = "";
|
||||
@@ -711,6 +748,8 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
||||
if (primofuoco) {
|
||||
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;
|
||||
if (!!recmediatore.note)
|
||||
data += "Note: " + recmediatore.note + tools.ACAPO;
|
||||
data += tools.ACAPO;
|
||||
|
||||
data += 'Il Mediatore sarà contattato 1 giorno prima dal Tutor' + tools.ACAPO;
|
||||
@@ -726,6 +765,7 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord) {
|
||||
return mystr;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return '';
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1099,14 +1139,17 @@ NaveSchema.statics.getNaveByUser = async function (idapp, ind_order, lang, fuoco
|
||||
const arrposiz = await Nave.getArrPosizioniByIndOrder(idapp, ind_order);
|
||||
if (!!arrposiz) {
|
||||
for (const pos of arrposiz) {
|
||||
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, rec);
|
||||
mystr += await Nave.getPlaccaPerMediatore(idapp, pos.riga, pos.col, false, rec);
|
||||
}
|
||||
}
|
||||
let mypos = {
|
||||
riga: pos.riga,
|
||||
col: pos.col,
|
||||
numup: 3,
|
||||
};
|
||||
tools.getRigaColByPosUp(mypos);
|
||||
|
||||
if (mystr === '') {
|
||||
mystr = tools.gettranslate('NO_PROG', lang);
|
||||
mystr += await Nave.getNavePos(idapp, mypos.riga, mypos.col, false);
|
||||
// mystr += await Nave.getPlaccaPerDonatore(idapp, pos.riga, pos.col, false, rec);
|
||||
// mystr += await Nave.getPlaccaPerMediatore(idapp, pos.riga, pos.col, false, rec);
|
||||
}
|
||||
}
|
||||
|
||||
return mystr;
|
||||
|
||||
Reference in New Issue
Block a user