File tree Expand file tree Collapse file tree
services/registration/src/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ statisticsRouter.route("/").get(
2525 checkAbility ( "aggregate" , "Application" ) ,
2626 asyncHandler ( async ( req , res ) => {
2727 const { hexathon } = req . query ;
28+ let branchId = req . query . branch as string | undefined ;
29+
30+ if ( branchId === "" ) {
31+ branchId = undefined ; // treat as undefined
32+ }
2833
2934 const branches = await BranchModel . find ( {
3035 hexathon : new mongoose . Types . ObjectId ( hexathon as string ) ,
@@ -47,11 +52,17 @@ statisticsRouter.route("/").get(
4752 0
4853 ) ;
4954
55+ const matchStage : any = {
56+ hexathon : new mongoose . Types . ObjectId ( hexathon as string ) ,
57+ } ;
58+
59+ if ( branchId ) {
60+ matchStage . applicationBranch = new mongoose . Types . ObjectId ( branchId ) ;
61+ }
62+
5063 const aggregatedApplications = await ApplicationModel . aggregate ( [
5164 {
52- $match : {
53- hexathon : new mongoose . Types . ObjectId ( hexathon as string ) ,
54- } ,
65+ $match : matchStage ,
5566 } ,
5667 {
5768 $facet : {
@@ -331,6 +342,7 @@ statisticsRouter.route("/").get(
331342
332343 for ( const interaction of eventInteractions ) {
333344 if ( ! interaction . event ) {
345+ // eslint-disable-next-line no-continue
334346 continue ;
335347 }
336348 const event = interaction . event ;
You can’t perform that action at this time.
0 commit comments