From 20ab2b3c0ef5ddb158747b6cdfd69038d7d016b7 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sat, 1 Aug 2026 05:06:51 +0530 Subject: [PATCH] fix: code quality and safety improvements --- server/modules/ai/service.js | 2 +- server/modules/codeforces/controller.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/ai/service.js b/server/modules/ai/service.js index fa565da..be2f715 100644 --- a/server/modules/ai/service.js +++ b/server/modules/ai/service.js @@ -44,7 +44,7 @@ CODEFORCES TELEMETRY: - Difficulty Distribution: ${ Object.entries(profile.stats?.byRating || {}) .filter(([, v]) => v > 0) - .sort(([a], [b]) => parseInt(a) - parseInt(b)) + .sort(([a], [b]) => parseInt(a, 10) - parseInt(b, 10)) .map(([r, c]) => `${r === "2500plus" ? "2500+" : r}(${c})`) .join(", ") || "No data yet" } diff --git a/server/modules/codeforces/controller.js b/server/modules/codeforces/controller.js index 9f904c4..0ffc7fb 100644 --- a/server/modules/codeforces/controller.js +++ b/server/modules/codeforces/controller.js @@ -69,7 +69,7 @@ class CodeforcesController { */ static async getRecentSubmissions(req, res, next) { try { - const count = Math.min(parseInt(req.query.count) || 20, 100); + const count = Math.min(parseInt(req.query.count, 10) || 20, 100); const submissions = await CodeforcesService.getRecentSubmissions( req.user._id, count