From ac0c0a776a3a0868be089a1295ab8989d4f25669 Mon Sep 17 00:00:00 2001 From: Ramaruva Date: Thu, 13 Feb 2025 14:57:38 -0600 Subject: [PATCH 1/5] fix(team): ensure team name is correctly assigned after creating a new team --- package-lock.json | 372 ++++++++++++++---------------- package.json | 2 +- src/controllers/teamController.js | 15 +- 3 files changed, 190 insertions(+), 199 deletions(-) diff --git a/package-lock.json b/package-lock.json index 69301079a..dab65f8af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1282,15 +1282,6 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, - "@emnapi/runtime": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", - "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", - "optional": true, - "requires": { - "tslib": "^2.4.0" - } - }, "@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -1377,147 +1368,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "@img/sharp-darwin-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", - "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", - "optional": true, - "requires": { - "@img/sharp-libvips-darwin-arm64": "1.0.4" - } - }, - "@img/sharp-darwin-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", - "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", - "optional": true, - "requires": { - "@img/sharp-libvips-darwin-x64": "1.0.4" - } - }, - "@img/sharp-libvips-darwin-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", - "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", - "optional": true - }, - "@img/sharp-libvips-darwin-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", - "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", - "optional": true - }, - "@img/sharp-libvips-linux-arm": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", - "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", - "optional": true - }, - "@img/sharp-libvips-linux-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", - "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", - "optional": true - }, - "@img/sharp-libvips-linux-s390x": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", - "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", - "optional": true - }, - "@img/sharp-libvips-linux-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", - "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", - "optional": true - }, - "@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", - "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", - "optional": true - }, - "@img/sharp-libvips-linuxmusl-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", - "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", - "optional": true - }, - "@img/sharp-linux-arm": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", - "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", - "optional": true, - "requires": { - "@img/sharp-libvips-linux-arm": "1.0.5" - } - }, - "@img/sharp-linux-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", - "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", - "optional": true, - "requires": { - "@img/sharp-libvips-linux-arm64": "1.0.4" - } - }, - "@img/sharp-linux-s390x": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", - "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", - "optional": true, - "requires": { - "@img/sharp-libvips-linux-s390x": "1.0.4" - } - }, - "@img/sharp-linux-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", - "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", - "optional": true, - "requires": { - "@img/sharp-libvips-linux-x64": "1.0.4" - } - }, - "@img/sharp-linuxmusl-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", - "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", - "optional": true, - "requires": { - "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" - } - }, - "@img/sharp-linuxmusl-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", - "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", - "optional": true, - "requires": { - "@img/sharp-libvips-linuxmusl-x64": "1.0.4" - } - }, - "@img/sharp-wasm32": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", - "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", - "optional": true, - "requires": { - "@emnapi/runtime": "^1.2.0" - } - }, - "@img/sharp-win32-ia32": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", - "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", - "optional": true - }, - "@img/sharp-win32-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", - "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", - "optional": true - }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -5019,7 +4869,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -5130,6 +4979,11 @@ "readdirp": "~3.6.0" } }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, "ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -5712,12 +5566,25 @@ "ms": "2.1.2" } }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + } + }, "dedent": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", "dev": true }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -5774,9 +5641,9 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, "detect-libc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", - "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==" }, "detect-newline": { "version": "3.1.0", @@ -5891,7 +5758,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -7059,6 +6925,11 @@ "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", "dev": true }, + "expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + }, "expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", @@ -7404,8 +7275,7 @@ "fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, "fs-readdir-recursive": { "version": "1.1.0", @@ -7520,6 +7390,11 @@ "get-intrinsic": "^1.1.1" } }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -7840,8 +7715,7 @@ "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "5.2.4", @@ -7951,6 +7825,11 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, "internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", @@ -11318,6 +11197,11 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -11329,8 +11213,7 @@ "minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" }, "mkdirp": { "version": "1.0.4", @@ -11338,6 +11221,11 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, "moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", @@ -11606,6 +11494,11 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" }, + "napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==" + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -11638,6 +11531,26 @@ } } }, + "node-abi": { + "version": "3.74.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.74.0.tgz", + "integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==", + "requires": { + "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==" + } + } + }, + "node-addon-api": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", + "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==" + }, "node-cache": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", @@ -12712,6 +12625,32 @@ "source-map-js": "^1.2.0" } }, + "prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "requires": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==" + } + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -12816,6 +12755,15 @@ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", "dev": true }, + "pump": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -12855,6 +12803,24 @@ "unpipe": "1.0.0" } }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==" + } + } + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -13304,38 +13270,24 @@ } }, "sharp": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", - "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", - "requires": { - "@img/sharp-darwin-arm64": "0.33.5", - "@img/sharp-darwin-x64": "0.33.5", - "@img/sharp-libvips-darwin-arm64": "1.0.4", - "@img/sharp-libvips-darwin-x64": "1.0.4", - "@img/sharp-libvips-linux-arm": "1.0.5", - "@img/sharp-libvips-linux-arm64": "1.0.4", - "@img/sharp-libvips-linux-s390x": "1.0.4", - "@img/sharp-libvips-linux-x64": "1.0.4", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", - "@img/sharp-libvips-linuxmusl-x64": "1.0.4", - "@img/sharp-linux-arm": "0.33.5", - "@img/sharp-linux-arm64": "0.33.5", - "@img/sharp-linux-s390x": "0.33.5", - "@img/sharp-linux-x64": "0.33.5", - "@img/sharp-linuxmusl-arm64": "0.33.5", - "@img/sharp-linuxmusl-x64": "0.33.5", - "@img/sharp-wasm32": "0.33.5", - "@img/sharp-win32-ia32": "0.33.5", - "@img/sharp-win32-x64": "0.33.5", - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.3" + "version": "0.29.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.3.tgz", + "integrity": "sha512-fKWUuOw77E4nhpyzCCJR1ayrttHoFHBT2U/kR/qEMRhvPEcluG4BKj324+SCO1e84+knXHwhJ1HHJGnUt4ElGA==", + "requires": { + "color": "^4.0.1", + "detect-libc": "^1.0.3", + "node-addon-api": "^4.2.0", + "prebuild-install": "^7.0.0", + "semver": "^7.3.5", + "simple-get": "^4.0.0", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" }, "dependencies": { "semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==" + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==" } } }, @@ -13360,6 +13312,21 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + }, + "simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -14345,11 +14312,21 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, + "tar-fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.2.tgz", + "integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==", + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, "tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, "requires": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", @@ -14362,7 +14339,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -14373,7 +14349,6 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -14475,7 +14450,16 @@ "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "requires": { + "safe-buffer": "^5.0.1" + } }, "type-check": { "version": "0.4.0", diff --git a/package.json b/package.json index bd0ba1123..3a1837a4d 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "nodemailer": "^6.4.16", "redis": "^4.2.0", "sanitize-html": "^2.13.0", - "sharp": "^0.33.5", + "sharp": "^0.29.3", "supertest": "^6.3.4", "uuid": "^3.4.0", "ws": "^8.17.1" diff --git a/src/controllers/teamController.js b/src/controllers/teamController.js index 9ce719a8c..22e943b22 100644 --- a/src/controllers/teamController.js +++ b/src/controllers/teamController.js @@ -8,7 +8,10 @@ const teamcontroller = function (Team) { const getAllTeams = function (req, res) { Team.aggregate([ { - $unwind: '$members', + $unwind: { + path: '$members', + preserveNullAndEmptyArrays: true, // Ensures teams with empty members arrays are retained + }, }, { $lookup: { @@ -19,7 +22,10 @@ const teamcontroller = function (Team) { }, }, { - $unwind: '$userProfile', + $unwind: { + path: '$userProfile', + preserveNullAndEmptyArrays: true, // Ensures that if no userProfile is found, the document is not removed + }, }, { $match: { @@ -32,7 +38,7 @@ const teamcontroller = function (Team) { teamId: '$_id', teamCode: '$userProfile.teamCode', }, - count: { $sum: 1 }, + count: { $sum: { $cond: [{ $ifNull: ['$members', false] }, 1, 0] } }, // Count only if members exist teamName: { $first: '$teamName' }, members: { $push: { @@ -71,7 +77,8 @@ const teamcontroller = function (Team) { Logger.logException(error); res.status(404).send(error); }); - }; +}; + const getTeamById = function (req, res) { const { teamId } = req.params; From c44bfb8930541d09c65ab1ac9955a17a5bcf35e7 Mon Sep 17 00:00:00 2001 From: Ramaruva Date: Wed, 13 Aug 2025 15:58:30 -0500 Subject: [PATCH 2/5] feat(badges): allow assigning badges to multiple users --- src/controllers/badgeController.js | 108 ++++++++++++++++++++++++++++- src/routes/badgeRouter.js | 11 ++- 2 files changed, 114 insertions(+), 5 deletions(-) diff --git a/src/controllers/badgeController.js b/src/controllers/badgeController.js index c270f4875..6d4921e0d 100644 --- a/src/controllers/badgeController.js +++ b/src/controllers/badgeController.js @@ -3,7 +3,7 @@ const UserProfile = require('../models/userProfile'); const helper = require('../utilities/permissions'); const escapeRegex = require('../utilities/escapeRegex'); const cacheClosure = require('../utilities/nodeCache'); -//const userHelper = require('../helpers/userHelper')(); +// const userHelper = require('../helpers/userHelper')(); const badgeController = function (Badge) { /** @@ -79,6 +79,109 @@ const badgeController = function (Badge) { return; } + let userIds; + let badgeCollection; + + if (req.params.userId) { + // Single user update case + userIds = [req.params.userId]; + badgeCollection = req.body.badgeCollection; + } else { + // Multi-user assign case + userIds = req.body.userIds; + console.log('userIDs:', userIds); + badgeCollection = req.body.selectedBadges.map((badgeId) => ({ + badge: badgeId.replace('assign-badge-', ''), + count: 1, + lastModified: Date.now(), + earnedDate: [new Date().toISOString()], + })); + console.log('badgeCollections', badgeCollection); + } + + if ( + !Array.isArray(userIds) || + userIds.length === 0 || + !Array.isArray(badgeCollection) || + badgeCollection.length === 0 + ) { + res + .status(400) + .send('Invalid input. Both userIds and badgeCollection must be non-empty arrays.'); + return; + } + + try { + const results = await Promise.all( + userIds.map(async (userId) => { + const userToBeAssigned = mongoose.Types.ObjectId(userId); + const record = await UserProfile.findById(userToBeAssigned); + + if (!record) { + return { userId, error: 'User not found' }; + } + + let totalNewBadges = 0; + const existingBadges = {}; + if (record.badgeCollection && Array.isArray(record.badgeCollection)) { + record.badgeCollection.forEach((badgeItem) => { + existingBadges[badgeItem.badge.toString()] = badgeItem; + }); + } + + // Merge existing badges with new ones + badgeCollection.forEach((badge) => { + const existingBadge = existingBadges[badge.badge.toString()]; + if (existingBadge) { + // Update the existing badge + existingBadge.count += badge.count; + existingBadge.lastModified = Date.now(); + existingBadge.earnedDate = [ + ...existingBadge.earnedDate, + ...(badge.earnedDate || [new Date().toISOString()]), + ]; + } else { + // Add the new badge + existingBadges[badge.badge.toString()] = { + badge: mongoose.Types.ObjectId(badge.badge), + count: badge.count, + lastModified: Date.now(), + earnedDate: badge.earnedDate || [new Date().toISOString()], + }; + totalNewBadges += badge.count; + } + }); + + // Convert the merged badges back to an array + record.badgeCollection = Object.values(existingBadges); + record.badgeCount += totalNewBadges; + + if (cache.hasCache(`user-${userToBeAssigned}`)) { + cache.removeCache(`user-${userToBeAssigned}`); + } + + await record.save(); + return { userId, success: true }; + }), + ); + + const errors = results.filter((result) => result.error); + if (errors.length > 0) { + res.status(207).send({ message: 'Some users were not assigned badges', errors }); + } else { + res.status(200).send({ message: 'Badges assigned successfully to all users' }); + } + } catch (err) { + res.status(500).send(`Internal Error: Badge Collection. ${err.message}`); + } + }; + + const assignBadgesToSingleUser = async function (req, res) { + if (!(await helper.hasPermission(req.body.requestor, 'assignBadges'))) { + res.status(403).send('You are not authorized to assign badges.'); + return; + } + const userToBeAssigned = mongoose.Types.ObjectId(req.params.userId); try { @@ -341,9 +444,10 @@ const badgeController = function (Badge) { }; return { - //awardBadgesTest, + // awardBadgesTest, getAllBadges, assignBadges, + assignBadgesToSingleUser, postBadge, deleteBadge, putBadge, diff --git a/src/routes/badgeRouter.js b/src/routes/badgeRouter.js index 553a31835..262ecccba 100644 --- a/src/routes/badgeRouter.js +++ b/src/routes/badgeRouter.js @@ -5,15 +5,20 @@ const routes = function (badge) { const badgeRouter = express.Router(); - //badgeRouter.get('/badge/awardBadgesTest', controller.awardBadgesTest); + // badgeRouter.get('/badge/awardBadgesTest', controller.awardBadgesTest); badgeRouter.route('/badge').get(controller.getAllBadges).post(controller.postBadge); badgeRouter.route('/badge/:badgeId').delete(controller.deleteBadge).put(controller.putBadge); - badgeRouter.route('/badge/assign/:userId').put(controller.assignBadges); + badgeRouter.route('/badge/assign').post(controller.assignBadges); - badgeRouter.route('/badge/badgecount/:userId').get(controller.getBadgeCount).put(controller.putBadgecount); + badgeRouter.route('/badge/assign/:userId').put(controller.assignBadgesToSingleUser); + + badgeRouter + .route('/badge/badgecount/:userId') + .get(controller.getBadgeCount) + .put(controller.putBadgecount); badgeRouter.route('/badge/badgecount/reset/:userId').put(controller.resetBadgecount); From e75b7dfd2f281cc3488df07ce79658b46d2b6b83 Mon Sep 17 00:00:00 2001 From: deep3072 Date: Sat, 27 Sep 2025 00:19:58 -0500 Subject: [PATCH 3/5] fix: add mentor pie chart --- src/controllers/reportsController.js | 8 ++ src/helpers/overviewReportHelper.js | 124 +++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) diff --git a/src/controllers/reportsController.js b/src/controllers/reportsController.js index f6af25fa0..809dde2ea 100644 --- a/src/controllers/reportsController.js +++ b/src/controllers/reportsController.js @@ -87,6 +87,7 @@ const reportsController = function () { try { const [ volunteerNumberStats, + mentorNumberStats, volunteerHoursStats, totalHoursWorked, tasksStats, @@ -110,6 +111,12 @@ const reportsController = function () { isoComparisonStartDate, isoComparisonEndDate, ), + overviewReportHelper.getMentorNumberStats( + isoStartDate, + isoEndDate, + isoComparisonStartDate, + isoComparisonEndDate, + ), overviewReportHelper.getHoursStats( isoStartDate, isoEndDate, @@ -184,6 +191,7 @@ const reportsController = function () { ]); res.status(200).send({ volunteerNumberStats, + mentorNumberStats, volunteerHoursStats, totalHoursWorked, tasksStats, diff --git a/src/helpers/overviewReportHelper.js b/src/helpers/overviewReportHelper.js index 3ee58d6e8..6f0bb8d23 100644 --- a/src/helpers/overviewReportHelper.js +++ b/src/helpers/overviewReportHelper.js @@ -1320,6 +1320,129 @@ const overviewReportHelper = function () { return res; }; + /** + * returns mentor counts for the provided date range + * mirrors volunteer stats but filters strictly on Mentor role + * @param {Date} startDate + * @param {Date} endDate + * @param {Date} comparisonStartDate + * @param {Date} comparisonEndDate + */ + const getMentorNumberStats = async ( + startDate, + endDate, + comparisonStartDate, + comparisonEndDate, + ) => { + const getMentorData = async (isoStartDate, isoEndDate) => { + const data = await UserProfile.aggregate([ + { + $facet: { + activeMentors: [ + { + $match: { + isActive: true, + role: 'Mentor', + createdDate: { $lte: isoEndDate }, + }, + }, + { $count: 'count' }, + ], + newMentors: [ + { + $match: { + role: 'Mentor', + createdDate: { + $gte: isoStartDate, + $lte: isoEndDate, + }, + }, + }, + { $count: 'count' }, + ], + deactivatedMentors: [ + { + $match: { + $and: [ + { lastModifiedDate: { $gte: isoStartDate } }, + { lastModifiedDate: { $lte: isoEndDate } }, + { isActive: false }, + { role: 'Mentor' }, + ], + }, + }, + { $count: 'count' }, + ], + }, + }, + ]); + + const activeMentors = data[0].activeMentors[0]?.count || 0; + const newMentors = data[0].newMentors[0]?.count || 0; + const deactivatedMentors = data[0].deactivatedMentors[0]?.count || 0; + const totalMentors = activeMentors + newMentors + deactivatedMentors; + + return { + activeMentors, + newMentors, + deactivatedMentors, + totalMentors, + }; + }; + + const { + activeMentors: currentActiveMentors, + newMentors: currentNewMentors, + deactivatedMentors: currentDeactivatedMentors, + totalMentors: currentTotalMentors, + } = await getMentorData(startDate, endDate); + + const mentorStats = { + activeMentors: { + count: currentActiveMentors, + percentageOutOfTotal: Math.round((currentActiveMentors / currentTotalMentors) * 100) / 100, + }, + newMentors: { + count: currentNewMentors, + percentageOutOfTotal: Math.round((currentNewMentors / currentTotalMentors) * 100) / 100, + }, + deactivatedMentors: { + count: currentDeactivatedMentors, + percentageOutOfTotal: + Math.round((currentDeactivatedMentors / currentTotalMentors) * 100) / 100, + }, + totalMentors: { count: currentTotalMentors }, + }; + + if (comparisonStartDate && comparisonEndDate) { + const { + activeMentors: comparisonActiveMentors, + newMentors: comparisonNewMentors, + deactivatedMentors: comparisonDeactivatedMentors, + totalMentors: comparisonTotalMentors, + } = await getMentorData(comparisonStartDate, comparisonEndDate); + + mentorStats.activeMentors.comparisonPercentage = calculateGrowthPercentage( + currentActiveMentors, + comparisonActiveMentors, + ); + mentorStats.newMentors.comparisonPercentage = calculateGrowthPercentage( + currentNewMentors, + comparisonNewMentors, + ); + mentorStats.deactivatedMentors.comparisonPercentage = calculateGrowthPercentage( + currentDeactivatedMentors, + comparisonDeactivatedMentors, + ); + mentorStats.totalMentors.comparisonPercentage = calculateGrowthPercentage( + currentTotalMentors, + comparisonTotalMentors, + ); + } + + return mentorStats; + }; + /** * * @returns The number of teams with 4 or more members. @@ -2004,6 +2127,7 @@ const overviewReportHelper = function () { getAnniversaries, getRoleDistributionStats, getVolunteerNumberStats, + getMentorNumberStats, getTasksStats, getWorkDistributionStats, getTotalHoursWorked, From 13cd444d31700e0e4fce3ffec188af70bbfa21d8 Mon Sep 17 00:00:00 2001 From: deep3072 Date: Sun, 7 Dec 2025 19:03:56 -0800 Subject: [PATCH 4/5] fix: update total mentors donut chart to use new donutChartData structure --- src/helpers/overviewReportHelper.js | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/helpers/overviewReportHelper.js b/src/helpers/overviewReportHelper.js index 178cfde78..3eb0687bc 100644 --- a/src/helpers/overviewReportHelper.js +++ b/src/helpers/overviewReportHelper.js @@ -1830,6 +1830,9 @@ const overviewReportHelper = function () { totalMentors: currentTotalMentors, } = await getMentorData(startDate, endDate); + // Calculate existing active mentors (active - new) + const currentExistingActive = currentActiveMentors - currentNewMentors; + const mentorStats = { activeMentors: { count: currentActiveMentors, @@ -1845,6 +1848,22 @@ const overviewReportHelper = function () { Math.round((currentDeactivatedMentors / currentTotalMentors) * 100) / 100, }, totalMentors: { count: currentTotalMentors }, + donutChartData: { + existingActive: { + count: currentExistingActive, + percentageOutOfTotal: + Math.round((currentExistingActive / currentTotalMentors) * 100) / 100, + }, + newActive: { + count: currentNewMentors, + percentageOutOfTotal: Math.round((currentNewMentors / currentTotalMentors) * 100) / 100, + }, + deactivated: { + count: currentDeactivatedMentors, + percentageOutOfTotal: + Math.round((currentDeactivatedMentors / currentTotalMentors) * 100) / 100, + }, + }, }; if (comparisonStartDate && comparisonEndDate) { @@ -1855,6 +1874,9 @@ const overviewReportHelper = function () { totalMentors: comparisonTotalMentors, } = await getMentorData(comparisonStartDate, comparisonEndDate); + // Calculate comparison existing active mentors + const comparisonExistingActive = comparisonActiveMentors - comparisonNewMentors; + mentorStats.activeMentors.comparisonPercentage = calculateGrowthPercentage( currentActiveMentors, comparisonActiveMentors, @@ -1871,6 +1893,18 @@ const overviewReportHelper = function () { currentTotalMentors, comparisonTotalMentors, ); + mentorStats.donutChartData.existingActive.comparisonPercentage = calculateGrowthPercentage( + currentExistingActive, + comparisonExistingActive, + ); + mentorStats.donutChartData.newActive.comparisonPercentage = calculateGrowthPercentage( + currentNewMentors, + comparisonNewMentors, + ); + mentorStats.donutChartData.deactivated.comparisonPercentage = calculateGrowthPercentage( + currentDeactivatedMentors, + comparisonDeactivatedMentors, + ); } return mentorStats; From e7a4f08aa9732bdaa49adc6a92237f8b5c78e030 Mon Sep 17 00:00:00 2001 From: Diya Wadhwani Date: Thu, 11 Dec 2025 19:23:43 -0500 Subject: [PATCH 5/5] fix(multiple): ReplyTo on BS assignment & WeeklyHours Display --- src/helpers/reporthelper.js | 13 ++++++++++--- src/helpers/userHelper.js | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/helpers/reporthelper.js b/src/helpers/reporthelper.js index 100fe23ce..4f27fcee9 100644 --- a/src/helpers/reporthelper.js +++ b/src/helpers/reporthelper.js @@ -170,10 +170,17 @@ const reporthelper = function () { result.totalSeconds = [0, 0, 0, 0]; if (!result.timeEntries || result.timeEntries.length === 0) return; - + const isSingleWeekRequest = startWeekIndex === endWeekIndex; result.timeEntries.forEach((entry) => { - const index = - startWeekIndex === endWeekIndex ? 0 : absoluteDifferenceInWeeks(entry.dateOfWork, pstEnd); + let index; + + if (isSingleWeekRequest) index = startWeekIndex; + else { + index = + startWeekIndex === endWeekIndex + ? 0 + : absoluteDifferenceInWeeks(entry.dateOfWork, pstEnd); + } if (index >= 0 && index < 4) { result.totalSeconds[index] = diff --git a/src/helpers/userHelper.js b/src/helpers/userHelper.js index 795b72569..507a1fbc5 100644 --- a/src/helpers/userHelper.js +++ b/src/helpers/userHelper.js @@ -1341,7 +1341,7 @@ const userHelper = function () { ), null, combinedCCList, - DEFAULT_REPLY_TO[0], + emailAddress, combinedBCCList, { type: 'blue_square_assignment' }, );