fix Richieste e Rifiutati (Circuiti)

This commit is contained in:
Surya Paolo
2022-12-15 18:09:43 +01:00
parent cce311cc2c
commit 9a32426b8d
2 changed files with 399 additions and 426 deletions

View File

@@ -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,
},
},
@@ -239,8 +172,9 @@ if (test) {
// aggregation = [...aggregation, ...passo1];
aggregation = [...aggregation, ...passo1];
// aggregation = [...aggregation, ...passo1b];
// aggregation = [...aggregation, ...passo1c];
// aggregation = [...aggregation, ...passo2];
aggregation = [...aggregation, ...passo1c];
aggregation = [...aggregation, ...passo2];
aggregation = [...aggregation, ...passo2b];
}
db.circuits.aggregate(aggregation);

File diff suppressed because it is too large Load Diff