- Nella Lavagna, cliccando sul nome dell'invitato, compaiono le sue informazioni sugli step rimasti, in dettaglio.
- Ogni utente puo' cosi scegliere di regalare un proprio invitato, cliccando sull'invitato, scrivendo l'username del destinatario e premendo il bottone 'Regala Invitato'. Al destinatario gli arriverà un messaggio sul Bot Telegram che indica che gli è stato regalato un'invitato.
This commit is contained in:
@@ -78,6 +78,9 @@ var ExtraListSchema = new mongoose.Schema({
|
||||
note: {
|
||||
type: String,
|
||||
},
|
||||
contacted: {
|
||||
type: Boolean,
|
||||
},
|
||||
col_b: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -87,17 +90,17 @@ var ExtraListSchema = new mongoose.Schema({
|
||||
registered: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
ExtraListSchema.methods.toJSON = function () {
|
||||
const extralist = this;
|
||||
const userObject = extralist.toObject();
|
||||
|
||||
return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
|
||||
};
|
||||
|
||||
// ExtraListSchema.methods.toJSON = function () {
|
||||
// const extralist = this;
|
||||
// const userObject = extralist.toObject();
|
||||
//
|
||||
// return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
|
||||
// };
|
||||
//
|
||||
ExtraListSchema.statics.findByUsername = function (idapp, username) {
|
||||
const ExtraList = this;
|
||||
|
||||
@@ -174,16 +177,30 @@ ExtraListSchema.statics.getDownlineNotRegisteredByNameSurname = function (idapp,
|
||||
'aportador_solidario_name_surname': nameandsurname,
|
||||
registered: false,
|
||||
}, {
|
||||
username: 1,
|
||||
ind_order: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
verified_email: 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.saw_zoom_presentation': 1,
|
||||
made_gift: 1,
|
||||
email: 1,
|
||||
date_reg: 1,
|
||||
img: 1
|
||||
cell_complete: 1,
|
||||
num_invitati: 1,
|
||||
nationality: 1,
|
||||
}, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
};
|
||||
|
||||
ExtraListSchema.statics.getUserNotRegisteredByNameSurname = function (idapp, nameandsurname) {
|
||||
const ExtraList = this;
|
||||
|
||||
return ExtraList.findOne({
|
||||
name_complete: nameandsurname,
|
||||
registered: false,
|
||||
}, {
|
||||
ind_order: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
cell_complete: 1,
|
||||
num_invitati: 1,
|
||||
nationality: 1,
|
||||
}, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ const _ = require('lodash');
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { Settings } = require('../models/settings');
|
||||
const { ExtraList } = require('../models/extralist');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const queryclass = require('../classes/queryclass');
|
||||
@@ -328,6 +329,7 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
|
||||
'idapp': idapp,
|
||||
'username': username,
|
||||
}, {
|
||||
ind_order: 1,
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
@@ -355,6 +357,8 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
|
||||
'idapp': idapp,
|
||||
'aportador_solidario': username,
|
||||
}, {
|
||||
aportador_solidario: 1,
|
||||
ind_order: 1,
|
||||
username: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
@@ -700,7 +704,7 @@ UserSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, username) {
|
||||
UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, username, aportador_solidario_nome_completo) {
|
||||
try {
|
||||
|
||||
// DATA: username, name, surname, email, intcode_cell, cell
|
||||
@@ -709,14 +713,21 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
|
||||
downline: []
|
||||
};
|
||||
|
||||
dashboard.myself = await User.getUserShortDataByUsername(idapp, username);
|
||||
// Data of my Aportador
|
||||
dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario);
|
||||
if (dashboard.aportador === undefined ) {
|
||||
dashboard.aportador = await ExtraList.getUserNotRegisteredByNameSurname(idapp, aportador_solidario_nome_completo);
|
||||
}
|
||||
|
||||
|
||||
// Data of my Downline
|
||||
const arrap = await User.getDownlineByUsername(idapp, aportador_solidario);
|
||||
dashboard.numpeople_aportador = arrap.length;
|
||||
|
||||
dashboard.downline = await User.getDownlineByUsername(idapp, username);
|
||||
dashboard.downnotreg = await ExtraList.getDownlineNotRegisteredByNameSurname(idapp, dashboard.myself.name + ' ' + dashboard.myself.surname);
|
||||
|
||||
dashboard.downbyuser = {};
|
||||
|
||||
for (const down of dashboard.downline) {
|
||||
|
||||
Reference in New Issue
Block a user