fix Registrazione data
fix linkref fix controllo login
This commit is contained in:
@@ -54,12 +54,18 @@ var ExtraListSchema = new mongoose.Schema({
|
||||
is_in_telegram: {
|
||||
type: Boolean,
|
||||
},
|
||||
is_staff: {
|
||||
type: Boolean,
|
||||
},
|
||||
cell_complete: {
|
||||
type: String
|
||||
},
|
||||
nationality: {
|
||||
type: String
|
||||
},
|
||||
saw_zoom_presentation: {
|
||||
type: Boolean
|
||||
},
|
||||
aportador_solidario_name_surname: {
|
||||
type: String,
|
||||
},
|
||||
@@ -86,26 +92,42 @@ var ExtraListSchema = new mongoose.Schema({
|
||||
});
|
||||
|
||||
ExtraListSchema.methods.toJSON = function () {
|
||||
var user = this;
|
||||
var userObject = user.toObject();
|
||||
const extralist = this;
|
||||
const userObject = extralist.toObject();
|
||||
|
||||
return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
|
||||
};
|
||||
|
||||
ExtraListSchema.statics.findByUsername = function (idapp, username) {
|
||||
const User = this;
|
||||
const ExtraList = this;
|
||||
|
||||
return User.findOne({
|
||||
return ExtraList.findOne({
|
||||
'idapp': idapp,
|
||||
'username': username,
|
||||
});
|
||||
};
|
||||
|
||||
ExtraListSchema.statics.getTotInLista = async function (idapp) {
|
||||
const ExtraList = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await ExtraList.count(myfind);
|
||||
};
|
||||
|
||||
ExtraListSchema.statics.getRegDellaLista = async function (idapp) {
|
||||
const ExtraList = this;
|
||||
|
||||
const myfind = { idapp, registered: true };
|
||||
|
||||
return await ExtraList.count(myfind);
|
||||
};
|
||||
|
||||
|
||||
ExtraListSchema.statics.findByCellAndNameSurname = function (idapp, cell_complete, name, surname) {
|
||||
var User = this;
|
||||
const ExtraList = this;
|
||||
|
||||
return User.findOne({
|
||||
return ExtraList.findOne({
|
||||
'idapp': idapp,
|
||||
'cell_complete': cell_complete,
|
||||
'name': name,
|
||||
@@ -187,24 +209,26 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
|
||||
if (sep !== '' && row !== '') {
|
||||
let col = row.split(sep);
|
||||
if (col) {
|
||||
if (col.length > 0) {
|
||||
if (col.length > 11) {
|
||||
let user = null;
|
||||
try {
|
||||
user = new ExtraList({
|
||||
idapp: idapp,
|
||||
ind_order: col[0],
|
||||
name_complete: col[2],
|
||||
num_invitati: col[3],
|
||||
is_in_whatsapp: col[4] !== '',
|
||||
is_in_telegram: col[5] !== '',
|
||||
cell_complete: col[6],
|
||||
nationality: col[7],
|
||||
aportador_solidario_name_surname: col[8],
|
||||
aportador_solidario_ind_order: col[9],
|
||||
aportador_solidario_originale_name_surname: col[10],
|
||||
note: col[11],
|
||||
col_b: col[12],
|
||||
col_h: col[13]
|
||||
name_complete: col[2].trim(),
|
||||
num_invitati: col[3].trim(),
|
||||
is_in_whatsapp: col[4].trim() !== '',
|
||||
is_in_telegram: col[5].trim() !== '',
|
||||
is_staff: col[5].trim() === 'VV',
|
||||
saw_zoom_presentation: col[6].trim() !== '',
|
||||
cell_complete: col[7].trim(),
|
||||
nationality: col[8].trim(),
|
||||
aportador_solidario_name_surname: col[9].trim(),
|
||||
aportador_solidario_ind_order: col[10].trim(),
|
||||
aportador_solidario_originale_name_surname: col[11].trim(),
|
||||
note: col[12].trim(),
|
||||
col_b: col[13].trim(),
|
||||
col_h: col[14].trim()
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -213,6 +237,9 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
|
||||
console.log('error ', e);
|
||||
}
|
||||
|
||||
if (user.cell_complete[0] !== '+')
|
||||
user.cell_complete = '+' + user.cell_complete;
|
||||
|
||||
namesurname = tools.extractNameAndSurnameByComplete(user.name_complete);
|
||||
user.name = namesurname.name;
|
||||
user.surname = namesurname.surname;
|
||||
@@ -235,7 +262,7 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
||||
console.log('error ', e);
|
||||
}
|
||||
|
||||
ris = { numadded, numtot, numalreadyexisted };
|
||||
|
||||
Reference in New Issue
Block a user