- 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:
Paolo Arena
2020-02-02 04:06:32 +01:00
parent 512a8c14e2
commit e386d2550b
9 changed files with 150 additions and 32 deletions

View File

@@ -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) {