✨✨✨ AGGIORNAMENTO SITO ✨✨✨
👉🏻 E' possibile ora visualizzare la Posizione Reale d'imbarco di quando si verrà aggiunti alle prossime Navi Definitive. Le posizioni verranno aggiornate ogni ora in automatico! 👉🏻 Ora gli imbarchi comprendono anche le navi provvisorie, pertanto è possibile annullarli oppure cambiare l'Invitante, dalla lista imbarchi. 👉🏻 E' ora possibile spostare gli invitati solo se si hanno piu' di 2 invitati per ogni Nave già partita. 👨🏻💻 Per i Tutor: 👉🏻- Sostituzioni : Cliccando su "Cerca il Primo Disponibile" vi suggerirà in automatico il primo passeggero disponibile per la sostituzione. ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
This commit is contained in:
@@ -250,7 +250,7 @@ NavePersistenteSchema.statics.findByRigaCol = function (idapp, riga, col) {
|
||||
|
||||
|
||||
NavePersistenteSchema.statics.getLastRigaCol = async function (idapp) {
|
||||
return NavePersistente.findOne({ idapp }).sort({ _id: -1 });
|
||||
return NavePersistente.findOne({ idapp }).sort({ riga: -1, col: -1 });
|
||||
};
|
||||
|
||||
NavePersistenteSchema.statics.getLastRigaColDefinitiva = async function (idapp) {
|
||||
@@ -270,6 +270,19 @@ NavePersistenteSchema.pre('save', async function (next) {
|
||||
next();
|
||||
});
|
||||
|
||||
function getNextDayNave(miadata) {
|
||||
|
||||
const dayofweek = [1, 3, 5]; // LUNEDI, MERCOLEDI, VENERDI
|
||||
|
||||
let mydate = tools.AddDate(miadata, 1);
|
||||
|
||||
while (!dayofweek.includes(mydate.getDay())) {
|
||||
mydate = tools.AddDate(mydate, 1);
|
||||
}
|
||||
|
||||
return mydate
|
||||
|
||||
}
|
||||
|
||||
NavePersistenteSchema.statics.addRecordNavePersistenteByParams = async function (params) {
|
||||
|
||||
@@ -281,14 +294,27 @@ NavePersistenteSchema.statics.addRecordNavePersistenteByParams = async function
|
||||
});
|
||||
|
||||
if (!giapresente) {
|
||||
// Prende la nave prima:
|
||||
const lastnave = await NavePersistente.findOne({idapp}).sort({riga: -1, col: -1});
|
||||
|
||||
let nextgiftchat = null;
|
||||
|
||||
if (((params.col - 1) % 8 === 0)) {
|
||||
nextgiftchat = getNextDayNave(lastnave.date_gift_chat_open);
|
||||
} else {
|
||||
nextgiftchat = lastnave.date_gift_chat_open;
|
||||
}
|
||||
|
||||
const next_date_start = tools.AddDate(nextgiftchat, 7);
|
||||
|
||||
let myNavePersistente = new NavePersistente({
|
||||
idapp: params.idapp,
|
||||
riga: params.riga,
|
||||
col: params.col,
|
||||
riga1don: params.riga1don,
|
||||
col1don: params.col1don,
|
||||
date_start: params.date_start,
|
||||
date_gift_chat_open: params.date_gift_chat_open,
|
||||
date_gift_chat_open: nextgiftchat,
|
||||
date_start: next_date_start,
|
||||
provvisoria: true,
|
||||
});
|
||||
return await myNavePersistente.save();
|
||||
|
||||
Reference in New Issue
Block a user