Skip to content

Commit d19487b

Browse files
author
Hans Kristian Flaatten
committed
fix(admin): precise calculation of new app and limit requests
1 parent 47ec917 commit d19487b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

apps/auth/controller.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,18 @@ app.get('/login/github/callback', (req, res, next) => {
9797
_id: 'TOTOAL',
9898
active: { $sum: { $cond: ['$apps.active', 1, 0] } },
9999
inactive: { $sum: { $cond: ['$apps.active', 0, 1] } },
100-
pending: { $sum: { $cond: ['$apps.approved', 0, 1] } },
101-
request: { $sum: { $cond: ['$apps.limit.rodRequest', 1, 0] } },
100+
pending: { $sum: { $cond: [{
101+
$and: [
102+
{ $eq: ['$apps.approved', false] },
103+
{ $not: ['$apps.rejection'] },
104+
],
105+
}, 1, 0] } },
106+
request: { $sum: { $cond: [{
107+
$or: [
108+
'$apps.limit.prodRequest',
109+
'$apps.limit.devRequest',
110+
],
111+
}, 1, 0] } },
102112
} },
103113
], (aggregateErr, result) => {
104114
if (aggregateErr) { return next(aggregateErr); }

0 commit comments

Comments
 (0)