Non permettere il cambio del codice del gruppo
disattivare l'abilitazione se la registrazione arriva da me paoloar77 Sistemato il Menu del BOT per inviare msg a tutti e per ricevere il proprio Link personale. Non permettere il cambio del codice del gruppo Aggiunta la Provincia tra parentesi nei Comuni: es Rimini (RN)
This commit is contained in:
@@ -114,24 +114,50 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
|
||||
}
|
||||
|
||||
let filterfindexact = {};
|
||||
if (strfind){
|
||||
if (strfind) {
|
||||
filterfindexact = {comune: strfind};
|
||||
}
|
||||
|
||||
let limit = 10
|
||||
let risexact = []
|
||||
|
||||
let limit = 10;
|
||||
let risexact = [];
|
||||
|
||||
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}};
|
||||
|
||||
let aggr1 = [
|
||||
{
|
||||
$match: {comune: strfind},
|
||||
},
|
||||
{ $limit : 1 },
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (params.filter) {
|
||||
filterfind = {...params.filter, ...filterfind}
|
||||
limit = 200
|
||||
} else{
|
||||
risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
filterfind = {...params.filter, ...filterfind};
|
||||
limit = 200;
|
||||
} else {
|
||||
// risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
risexact = await City.aggregate(aggr1);
|
||||
}
|
||||
|
||||
let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(limit);
|
||||
let aggr2 = [
|
||||
{
|
||||
$match: filterfind,
|
||||
},
|
||||
{ $limit : limit },
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
// let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(limit);
|
||||
let ris = await City.aggregate(aggr2).limit(limit);
|
||||
|
||||
return [...risexact, ...ris];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user