Aggiornamenti 2
This commit is contained in:
@@ -362,7 +362,7 @@ NaveSchema.statics.findGeneric = function (myrigacol) {
|
||||
}
|
||||
return null;
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
console.error(e.message);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -591,7 +591,7 @@ NaveSchema.statics.getPlaccaGenerica = async function (idapp, riga, col, offset,
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.message);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -755,9 +755,9 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord, in
|
||||
if (!!recnavepersistente.tutor_namesurname)
|
||||
data += '👤 ' + tools.get__('Tutor che affianchèra il Mediatore', lang) + ': "' + recnavepersistente.tutor_namesurname + '"' + tools.ACAPO;
|
||||
|
||||
data += '💬 ' + tools.get__('Giorno di Apertura GIFT CHAT', lang) + ': ' + tools.getstrDateLong(recnavepersistente.date_gift_chat_open) + tools.ACAPO;
|
||||
data += '💬 ' + tools.get__('Giorno di Apertura GIFT CHAT', lang) + ': ' + tools.getstrDateLong(recnavepersistente.date_gift_chat_open, lang) + tools.ACAPO;
|
||||
|
||||
data += '🎁 ' + tools.get__('Giorno in cui Inviare il DONO', lang) + ' : ' + tools.getstrDateLong(recnavepersistente.date_start) + tools.ACAPO;
|
||||
data += '🎁 ' + tools.get__('Giorno in cui Inviare il DONO', lang) + ' : ' + tools.getstrDateLong(recnavepersistente.date_start, lang) + tools.ACAPO;
|
||||
if (!!recnavepersistente.note_bot)
|
||||
data += tools.get__('Note', lang) + ": " + recnavepersistente.note_bot + tools.ACAPO;
|
||||
|
||||
@@ -771,7 +771,7 @@ NaveSchema.statics.getNavePos = async function (idapp, riga, col, solorecord, in
|
||||
|
||||
return mystr;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e.message);
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -955,7 +955,7 @@ async function addRecordNaveByParams(params, siRitesse) {
|
||||
return false;
|
||||
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
console.error(e.message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ NaveSchema.statics.checkifDeveRitessersi = async function (recuser) {
|
||||
|
||||
let deveritessersi = true;
|
||||
|
||||
arrrec = await Nave.find({ idapp: recuser.idapp, ind_order: recuser.ind_order });
|
||||
arrrec = await Nave.find({ idapp: recuser.idapp, ind_order: recuser.ind_order, num_tess: recuser.num_tess });
|
||||
|
||||
if (!!arrrec) {
|
||||
if ((arrrec.length % 2) === 0) {
|
||||
@@ -1009,11 +1009,11 @@ NaveSchema.statics.addUserFromListaIngresso_IntoNave = async function (init, ida
|
||||
if (!!recmediatore) {
|
||||
const ris = await Nave.checkifDeveRitessersi(recmediatore);
|
||||
if (ris.deveritessersi) {
|
||||
console.log('Si deve ritesere: [riga=', params.riga, 'col', params.col, ']');
|
||||
console.log('Si deve ritessere: [riga=', params.riga, 'col', params.col, ']');
|
||||
if (ris.deveritessersi) {
|
||||
params.ind_order = recmediatore.ind_order;
|
||||
params.id = recmediatore._id;
|
||||
params.num_tess = ris.num_tess + 1;
|
||||
params.num_tess = recmediatore.num_tess + 1;
|
||||
|
||||
await addRecordNaveByParams(params, true);
|
||||
}
|
||||
@@ -1189,7 +1189,14 @@ NaveSchema.statics.getNaveByUser = async function (idapp, ind_order, lang, fuoco
|
||||
};
|
||||
tools.getRigaColByPosUp(mypos);
|
||||
|
||||
mystr += await Nave.getNavePos(idapp, mypos.riga, mypos.col, false, ind_order);
|
||||
let persistente = await NavePersistente.findByRigaColByDonatore(idapp, pos.riga, pos.col, 0);
|
||||
if (!!persistente) {
|
||||
if (persistente.provvisoria) {
|
||||
mystr += tools.ACAPO + tools.get__('NAVE', lang) + ' ' + '[' + mypos.riga + '.' + mypos.col + '] - ' + tools.get__('TEMPORANEA', lang) + tools.ACAPO+ tools.ACAPO;
|
||||
} else {
|
||||
mystr += await Nave.getNavePos(idapp, mypos.riga, mypos.col, false, ind_order);
|
||||
}
|
||||
}
|
||||
// mystr += await Nave.getPlaccaPerDonatore(idapp, pos.riga, pos.col, false, rec);
|
||||
// mystr += await Nave.getPlaccaPerMediatore(idapp, pos.riga, pos.col, false, rec);
|
||||
}
|
||||
@@ -1299,13 +1306,32 @@ NaveSchema.statics.ricalcolaNave = async function (idapp, nave, riga1don, col1do
|
||||
|
||||
nave._doc.rec = nave.rec;
|
||||
}
|
||||
}catch (e) {
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
|
||||
return nave;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
NaveSchema.statics.getNextNumTess = async function (idapp, ind_order) {
|
||||
const Nave = this;
|
||||
|
||||
const rec = await Nave.findOne({ idapp, ind_order }, { num_tess: 1 }).sort({ num_tess: -1 });
|
||||
if (!!rec) {
|
||||
|
||||
if (rec.num_tess % 2 === 0) {
|
||||
rec.num_tess++;
|
||||
} else {
|
||||
rec.num_tess += 2;
|
||||
}
|
||||
|
||||
return rec.num_tess
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
const Nave = mongoose.model('Nave', NaveSchema);
|
||||
|
||||
Reference in New Issue
Block a user