- Entri in Circuito Italia solo se hai il fido nel circuito provinciale

- Aggiunta Zona, oltre alla provincia, per visualizzare i vari circuiti della prov
This commit is contained in:
Surya Paolo
2023-12-06 00:41:50 +01:00
parent 6edba03eff
commit d5bc76335f
7 changed files with 53 additions and 34 deletions

View File

@@ -725,9 +725,8 @@ AccountSchema.statics.removeAdminOfAccount = async function (idapp, username, ci
// Rimuovi l'account
AccountSchema.statics.removeAccount = async function (accountId) {
const { Circuit } = require('../models/circuit');
return await Circuit.deleteOne({ _id: accountId});
return await Account.deleteOne({ _id: accountId});
};
AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) {

View File

@@ -1110,7 +1110,7 @@ CircuitSchema.statics.getListCircuitsByUsername = async function (idapp, usernam
if (account.groupname === '') {
mystr += '\n👉🏻 ' + account.circuit.name + '\n';
mystr += ' [Saldo: ' + account.saldo + ' RIS, ';
mystr += ' Fido: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Fiducia: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Transato: ' + account.totTransato + ' RIS]';
}
}
@@ -1121,7 +1121,7 @@ CircuitSchema.statics.getListCircuitsByUsername = async function (idapp, usernam
if (myuser.profile.mycircuits.find((rec) => (rec.circuitname === account.circuit.name))) {
mystr += '\n GRUPPO: 👉🏻 <b>' + account.groupname + '</b> in ' + account.circuit.name + '\n';
mystr += ' [Saldo: ' + account.saldo + ' RIS, ';
mystr += ' Fido: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Fiducia: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Transato: ' + account.totTransato + ' RIS]';
}
}

View File

@@ -507,9 +507,26 @@ MyGroupSchema.statics.addCircuitFromGroup = async function (idapp, groupname, ci
// Rimuovo il Circuito all'interno del Gruppo
MyGroupSchema.statics.removeCircuitFromGroup = async function (idapp, groupname, circuitname) {
return await this.updateOne({ idapp, groupname },
const ris = await this.updateOne({ idapp, groupname },
{ $pull: { 'mycircuits': { circuitname: { $in: [circuitname] } } } });
const circuitId = await Circuit.getCircuitIdByName(idapp, circuitname);
let remove = false;
// Se il mio account non è stato utilizzato, allora lo cancello anche questo
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, false, groupname, '');
if (myaccount && myaccount.totTransato === 0) {
remove = true;
} else {
remove = true;
}
if (remove) {
await Account.removeAccount(myaccount._id);
}
};
MyGroupSchema.statics.getQueryReceiveRISGroups = function (idapp, hours) {

View File

@@ -2085,8 +2085,8 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
if (value) {
// Aggiungi alle amicizie
await this.setFriendsCmd(req, idapp, usernameOrig, usernameDest,
shared_consts.FRIENDSCMD.SETFRIEND, value);
// await this.setFriendsCmd(req, idapp, usernameOrig, usernameDest,
// shared_consts.FRIENDSCMD.SETFRIEND, value);
msgOrig = i18n.__({ phrase: '✅ Hai Abilitato l\'accesso alla App a %s !', locale: userDest.lang }, userDest.username);
msgDest = i18n.__({ phrase: '✅ Sei stato Abilitato correttamente da %s!', locale: lang }, usernameOrig);