fix Richieste e Rifiutati (Circuiti)
This commit is contained in:
@@ -2,18 +2,6 @@ use('test_FreePlanet');
|
||||
|
||||
let passo1 =
|
||||
[
|
||||
{
|
||||
$match: {
|
||||
idapp: "13",
|
||||
"profile.mycircuits": {
|
||||
$elemMatch: {
|
||||
circuitname: {
|
||||
$eq: "Riso Rovigo",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "circuits",
|
||||
@@ -49,62 +37,6 @@ let passo1 =
|
||||
|
||||
];
|
||||
|
||||
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: {
|
||||
@@ -122,6 +54,7 @@ let passo1c = [
|
||||
let passo2 = [
|
||||
{
|
||||
$project: {
|
||||
name: 1,
|
||||
'req_users': 1,
|
||||
},
|
||||
},
|
||||
@@ -238,9 +171,10 @@ if (test) {
|
||||
} else {
|
||||
// aggregation = [...aggregation, ...passo1];
|
||||
aggregation = [...aggregation, ...passo1];
|
||||
// aggregation = [...aggregation, ...passo1b];
|
||||
// aggregation = [...aggregation, ...passo1c];
|
||||
// aggregation = [...aggregation, ...passo2];
|
||||
// aggregation = [...aggregation, ...passo1b];
|
||||
aggregation = [...aggregation, ...passo1c];
|
||||
aggregation = [...aggregation, ...passo2];
|
||||
aggregation = [...aggregation, ...passo2b];
|
||||
}
|
||||
|
||||
db.circuits.aggregate(aggregation);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user