- Nuovo Sistema di Flotte per Tutor.

X - Mettere anche la email del sognatore, per chi è abituato ad inviarla in quel modo...
X - Controllare che sul sito compaiano le informazioni del Sognatore...
This commit is contained in:
Paolo Arena
2020-06-08 13:31:05 +02:00
parent 140e181fcc
commit c939be279e
21 changed files with 2037 additions and 254 deletions

View File

@@ -25,6 +25,7 @@ const webpush = require('web-push');
const FILELOG = 'filelog.txt';
const FILEEVENTS = 'logevents.txt';
const FILEMANAGERS = 'logmanagers.txt';
const FILESOSTITUZIONI = 'log_sostituzioni.txt';
const FILENAVE = 'logNave.txt';
const subject = process.env.URLBASE_APP1;
const publicVapidKey = process.env.PUBLIC_VAPI_KEY;
@@ -114,6 +115,7 @@ textlang = {
'TEMPORANEA': 'TEMPORANEA',
'NAVE': 'NAVE',
'MSG_SEND_FROM': 'Msg Inviato da',
'VUOI_IMBARCARTI': 'Attenzione! Ci risulta che attualmente non ti è stato assegnato <strong>Nessun Imbarco</strong>.\nQuesto può essere dovuto ad un errore durante la fase di aggiornamento del sito, oppure perchè tu stesso hai cancellato l\'imbarco.\n\n<strong>Vuoi Aggiungerti ora al prossimo Imbarco per continuare nel tuo Viaggio in AYNI</strong>? ',
},
si: {
"Email je že bila preverjena": "Email je že bila preverjenaL'Email è già stata Verificata",
@@ -181,6 +183,7 @@ textlang = {
'TEMPORANEA': 'ZAČASNA',
'NAVE': 'LADJE',
'MSG_SEND_FROM': 'sporočilo, ki ga je poslal',
'VUOI_IMBARCARTI': 'Pozor! Opazili smo, da ti trenutno ni bila dodeljena <strong>Nobena ladjica</strong>.\nTo je lahko posledica napake med fazo posodabljanja spletnega mesta ali ker si sam zbrisal svoj vpis.\n\n<strong>Ali želiš nadaljevati plovbo, če želiš nadaljevati potovanje z AYNI </strong>?',
},
es: {
"L'Email è già stata Verificata": "El correo electrónico ya ha sido verificado",
@@ -246,6 +249,7 @@ textlang = {
'TEMPORANEA': 'TEMPORAL',
'NAVE': 'NAVE',
'MSG_SEND_FROM': 'Mensaje enviado por',
'VUOI_IMBARCARTI': '¡Atención! Entendemos que actualmente no está asignado a <strong>No Boarding</strong>.\nEsto puede deberse a un error durante la fase de actualización del sitio web, o porque usted mismo ha cancelado el embarque.\n\n¿Quieres añadirte ahora al próximo embarque para continuar tu viaje en AYNI?',
},
enUs: {
"partecipanti": "participants",
@@ -308,6 +312,7 @@ textlang = {
'TEMPORANEA': 'TEMPORARY',
'NAVE': 'SHIP',
'MSG_SEND_FROM': 'Msg sent by',
'VUOI_IMBARCARTI': 'Attention! We understand that you have <strong>No Boarding</strong> assigned.\nThis may be due to an error during the site update phase, or because you have cancelled boarding yourself.\n\n<strong>Do you want to add now to the Next Boarding to continue your AYNI Trip</strong>?',
},
fr: {
"L'Email è già stata Verificata": "Le courrier électronique a déjà été vérifié",
@@ -374,6 +379,7 @@ textlang = {
'TEMPORANEA': 'TEMPORAIRE',
'NAVE': 'NAVIRE',
'MSG_SEND_FROM': 'Message envoyé par',
'VUOI_IMBARCARTI': 'Attention ! Nous comprenons que vous n\'êtes actuellement pas affecté <strong>Pas d\'embarquement</strong>.\nCela peut être dû à une erreur lors de la phase de mise à jour du site, ou parce que vous avez vous-même annulé l\'embarquement.\n\n<strong>Voulez-vous vous ajouter maintenant au prochain embarquement pour continuer votre voyage AYNI</strong> ? ',
},
pt: {
"L'Email è già stata Verificata": "",
@@ -440,6 +446,7 @@ textlang = {
'TEMPORANEA': 'TEMPORÁRIO',
'NAVE': 'NAVE',
'MSG_SEND_FROM': 'Mensagem enviada por',
'VUOI_IMBARCARTI': 'Atenção! Compreendemos que actualmente não lhe é atribuído <strong>Sem Embarque</strong>.\nIsto pode ser devido a um erro durante a fase de actualização do site, ou porque você mesmo cancelou o embarque.\n\n<strong>Deseja juntar-se agora ao próximo embarque para continuar a sua viagem AYNI</strong>?',
},
};
@@ -449,6 +456,7 @@ module.exports = {
ACAPO: '\n',
ENABLE_CRONTAB: 'CRONTAB',
UPDATE_GRADUATORIA: 'UPDATE_GRAD',
LANGADMIN: 'it',
@@ -465,6 +473,12 @@ module.exports = {
SEND_MSG: 2,
SEND_MSG_SINGOLO: 3,
SEND_TO_ALL: 10,
SEND_MSG_EFFETTUA_IL_DONO: 1000,
SEND_MSG_SOLLECITO_DONATORI_NO_DONO: 1005,
SEND_MSG_A_MEDIATORI: 1010,
SEND_MSG_A_SOGNATORE: 1020,
SEND_MSG_A_UTENTE_SOSTITUITO: 1030,
SEND_MSG_DONO_RICEVUTO_CORRETTAMENTE: 1040,
},
Placca: {
@@ -982,6 +996,8 @@ module.exports = {
'note': { $exists: true },
"$expr": { "$gt": [{ "$strLenCP": "$note" }, 1] }
});
if (params.filterand.includes(shared_consts.FILTER_QUALIFIED))
filtriadded.push({ 'profile.qualified': true });
if (params.filterand.includes(shared_consts.FILTER_USER_NO_ZOOM))
filtriadded.push({ 'profile.saw_zoom_presentation': false });
if (params.filterand.includes(shared_consts.FILTER_USER_NO_INVITANTE))
@@ -1010,6 +1026,11 @@ module.exports = {
filtriadded.push({
deleted: { $exists: true, $eq: true }
});
if (params.filterand.includes(shared_consts.FILTER_NAVI_NON_PRESENTI))
filtriadded.push({
navinonpresenti: { $exists: true, $eq: true },
$or: [{ subaccount: { $exists: false } }, { subaccount: { $exists: true, $eq: false } }]
});
}
@@ -1210,7 +1231,7 @@ module.exports = {
numup
};
if (idapp === tools.AYNI) {
if (idapp === this.AYNI) {
this.getRigaColByPosUp(mypos);
ris = this.getlimiti(mypos);
}
@@ -1294,6 +1315,15 @@ module.exports = {
}
},
getstrDateLongFile(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return mydate.getFullYear() + '-' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '-' + this.appendLeadingZeroes(mydate.getDate()) + ' (' + this.getWeekDayByLang(mydate, lang) + ')'
} else {
return '';
}
},
getlinkzoom(idconf) {
if (idconf === '')
idconf = '6668882000';
@@ -1378,12 +1408,22 @@ module.exports = {
// console.log('Saved!');
// });
// mystr = this.getstrDateTimeShort(Date.now()) + ' ' + mystr;
mystr = this.getstrDateTimeShort(new Date(), 'it') + ': ' + mystr;
const stream = fs.createWriteStream(filename, { flags: 'a' });
stream.write('\n' + mystr);
stream.end();
},
readlogfile(idapp, filename) {
try{
return fs.readFileSync(idapp + '/' + filename, 'utf8');
}catch (e) {
return '';
}
},
writelog(mystr) {
this.writelogfile(mystr, FILELOG);
},
@@ -1396,6 +1436,20 @@ module.exports = {
this.writelogfile(mystr, FILEMANAGERS);
},
writeSostituzioniLog(mystr) {
this.writelogfile(mystr, FILESOSTITUZIONI);
},
writeFlottaLog(idapp, mystr, riga, col) {
this.mkdirpath(idapp + '/');
this.writelogfile(mystr, idapp + '/' + riga + '_' + col + '.txt');
},
readFlottaLog(idapp, riga, col) {
const nomefile = riga + '_' + col + '.txt';
return this.readlogfile(idapp, nomefile);
},
writeNaveLog(mystr) {
this.writelogfile(mystr, FILENAVE);
},
@@ -1523,6 +1577,9 @@ module.exports = {
if ('username' in fieldsvalue) {
return true;
}
if ('note' in fieldsvalue) {
return true;
}
}
if (table === 'navi') {
@@ -1541,12 +1598,15 @@ module.exports = {
return true;
}
}
if (table === 'flotte') {
return true;
}
return false;
},
NotifyIfDelRecord(table) {
if ((table === 'users') || (table === 'extralist') || (table === 'listaingressos')) {
if ((table === 'users') || (table === 'extralist') || (table === 'listaingressos') || (table === 'graduatorias')) {
return true;
}
@@ -1572,5 +1632,41 @@ module.exports = {
return Math.pow(2, riga - 1);
},
getPrimoFuocoByIndCol(col) {
// let ris = Math.ceil(col - (col % 8)) + 1;
let ris = ((Math.ceil(col / 8) - 1) * 8) + 1;
if (ris <= 0)
ris = 1;
return ris
},
getPrimaColFlotta(col) {
// let ris = Math.ceil(col - (col % 8)) + 1;
let ris = ((Math.ceil(col / 64) - 1) * 64) + 1;
if (ris <= 0)
ris = 1;
return ris
},
getStrMsgByTipoMsg(tipomsg) {
let mystr = '';
if (tipomsg === this.TipoMsg.SEND_MSG_EFFETTUA_IL_DONO)
mystr = 'Inviato Messaggio per Effettuare il Dono a Tutta la Flotta';
else if (tipomsg === this.TipoMsg.SEND_MSG_SOLLECITO_DONATORI_NO_DONO)
mystr = 'Inviato Messaggio per RICORDARE di Effettuare il Dono a chi ancora non l\'ha fatto';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_MEDIATORI)
mystr = 'Inviato Messaggio ai Mediatori';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_SOGNATORE)
mystr = 'Inviato Messaggio al Sognatore';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_UTENTE_SOSTITUITO)
mystr = 'Inviato Messaggio all\'utente Sostituito';
else if (tipomsg === this.TipoMsg.SEND_MSG_DONO_RICEVUTO_CORRETTAMENTE)
mystr = 'Inviato Messaggio Dono Ricevuto Correttamente';
return mystr;
}
};