++ DebugOn status (to see what happened)
fix visu activities
This commit is contained in:
246
mongodb/richieste_inviate_circuiti.mongodb
Normal file
246
mongodb/richieste_inviate_circuiti.mongodb
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
use('test_FreePlanet');
|
||||||
|
|
||||||
|
let passo1 =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
idapp: "13",
|
||||||
|
"profile.mycircuits": {
|
||||||
|
$elemMatch: {
|
||||||
|
circuitname: {
|
||||||
|
$eq: "Riso Rovigo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "circuits",
|
||||||
|
as: "circuit",
|
||||||
|
let: {
|
||||||
|
circuitname: "Riso Rovigo",
|
||||||
|
idapp: "$idapp",
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$name",
|
||||||
|
"$$circuitname",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$idapp",
|
||||||
|
"$$idapp",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
let passo1b = [
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "accounts",
|
||||||
|
as: "account",
|
||||||
|
let: {
|
||||||
|
username: "$username",
|
||||||
|
idapp: "$idapp",
|
||||||
|
circuitId: "$circuit._id",
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$$username",
|
||||||
|
"$username",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$$idapp",
|
||||||
|
"$idapp",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$$circuitId",
|
||||||
|
"$circuitId",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$unwind: "$account",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
idapp: "13",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$sort: {
|
||||||
|
desc: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
let passo1c = [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$eq: [
|
||||||
|
"$_id",
|
||||||
|
"633ed3454b03da33f944da14",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
let passo2 = [
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
'req_users': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
let passo2b = [
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
localField: "req_users.username",
|
||||||
|
foreignField: "username",
|
||||||
|
as: "user",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: {
|
||||||
|
$mergeObjects: [
|
||||||
|
{
|
||||||
|
$arrayElemAt: [
|
||||||
|
"$user",
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"$$ROOT",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
"user.idapp": 1,
|
||||||
|
"user.username": 1,
|
||||||
|
"user.profile.img": 1,
|
||||||
|
"user.profile.qualifica": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$unwind: "$user",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$and: [
|
||||||
|
{
|
||||||
|
"user.idapp": "13",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: "$user",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$and: [
|
||||||
|
{
|
||||||
|
$or: [
|
||||||
|
{
|
||||||
|
visibility: {
|
||||||
|
$nin: [
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createdBy: {
|
||||||
|
$eq: "paoloar77",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$group: {
|
||||||
|
_id: null,
|
||||||
|
count: {
|
||||||
|
$sum: 1,
|
||||||
|
},
|
||||||
|
results: {
|
||||||
|
$push: "$$ROOT",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
count: 1,
|
||||||
|
rows: {
|
||||||
|
$slice: [
|
||||||
|
"$results",
|
||||||
|
0,
|
||||||
|
10,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
let passo3 = [
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
let aggregation = [];
|
||||||
|
|
||||||
|
let test = false;
|
||||||
|
|
||||||
|
if (test) {
|
||||||
|
aggregation = [...aggregation, ...passo4];
|
||||||
|
} else {
|
||||||
|
// aggregation = [...aggregation, ...passo1];
|
||||||
|
aggregation = [...aggregation, ...passo1];
|
||||||
|
// aggregation = [...aggregation, ...passo1b];
|
||||||
|
// aggregation = [...aggregation, ...passo1c];
|
||||||
|
// aggregation = [...aggregation, ...passo2];
|
||||||
|
}
|
||||||
|
|
||||||
|
db.circuits.aggregate(aggregation);
|
||||||
@@ -217,7 +217,8 @@ CircuitSchema.statics.getFieldsForSearch = function() {
|
|||||||
{field: 'nome_circuito', type: tools.FieldType.string},
|
{field: 'nome_circuito', type: tools.FieldType.string},
|
||||||
{field: 'sotto_nome', type: tools.FieldType.string},
|
{field: 'sotto_nome', type: tools.FieldType.string},
|
||||||
{field: 'nome_valuta', type: tools.FieldType.string},
|
{field: 'nome_valuta', type: tools.FieldType.string},
|
||||||
{field: 'descr', type: tools.FieldType.string}];
|
{field: 'descr', type: tools.FieldType.string},
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
CircuitSchema.statics.executeQueryTable = function(idapp, params, user) {
|
CircuitSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ const SiteSchema = new Schema({
|
|||||||
enableTodos: { type: Boolean },
|
enableTodos: { type: Boolean },
|
||||||
enableRegByBot: { type: Boolean },
|
enableRegByBot: { type: Boolean },
|
||||||
enableRegMultiChoice: { type: Boolean },
|
enableRegMultiChoice: { type: Boolean },
|
||||||
|
enableDebugOn: { type: Boolean },
|
||||||
enabledRegNeedTelegram: { type: Boolean },
|
enabledRegNeedTelegram: { type: Boolean },
|
||||||
showViewGroups: { type: Boolean },
|
showViewGroups: { type: Boolean },
|
||||||
showViewCircuits: { type: Boolean },
|
showViewCircuits: { type: Boolean },
|
||||||
|
|||||||
Reference in New Issue
Block a user