Skip to content

Commit aeb6050

Browse files
BigMichi1Copilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 9353385 commit aeb6050

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/bot/database/codeManager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,17 @@ class CodeManager {
350350
codes: string[],
351351
discordIds: string[]
352352
): Promise<Map<string, Set<string>>> {
353+
if (codes.length === 0 || discordIds.length === 0) return new Map();
354+
353355
const SQLITE_PARAM_LIMIT = 999;
354356
const STATUS_COUNT = 3; // 'Success', 'Already Redeemed', 'Code Expired'
355357
// codes + status params are fixed per query; remaining budget is for discordIds
356358
const discordIdChunkSize = SQLITE_PARAM_LIMIT - codes.length - STATUS_COUNT;
357359
if (discordIdChunkSize <= 0) {
358360
throw new Error('Too many codes provided to getRedeemedCodesByUsers');
359361
}
360-
const result = new Map<string, Set<string>>();
361-
if (codes.length === 0 || discordIds.length === 0) return result;
362362

363+
const result = new Map<string, Set<string>>();
363364
const qualifyingStatuses = ['Success', 'Already Redeemed', 'Code Expired'] as const;
364365
for (let i = 0; i < discordIds.length; i += discordIdChunkSize) {
365366
const chunk = discordIds.slice(i, i + discordIdChunkSize);

0 commit comments

Comments
 (0)