From d448101b3202deb3cb29ca697df86ea489a5abc3 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Wed, 9 Aug 2023 17:56:35 +0000 Subject: [PATCH] fix: swapped start and end min and max --- src/core/discord/resolvePeriodFromCommand.ts | 12 ++++++------ src/core/express/resolvePeriodFromURL.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/discord/resolvePeriodFromCommand.ts b/src/core/discord/resolvePeriodFromCommand.ts index 360c54a12..564226944 100644 --- a/src/core/discord/resolvePeriodFromCommand.ts +++ b/src/core/discord/resolvePeriodFromCommand.ts @@ -30,13 +30,13 @@ export default function resolvePeriodFromCommand( if (periodSubcommand === 'custom') { const startRaw = interaction.options.getInteger('start', true); const endRaw = interaction.options.getInteger('end', true); - const startDaysAgoMax = Math.min(startRaw, endRaw); - const endDaysAgoMin = Math.max(startRaw, endRaw); + const startDaysAgoMin = Math.min(startRaw, endRaw); + const endDaysAgoMax = Math.max(startRaw, endRaw); - statsName = `${startDaysAgoMax} to ${endDaysAgoMin} days' statistics`; - evolutionName = `${startDaysAgoMax} to ${endDaysAgoMin} days' evolution`; - start = getTimeDaysAgo(region, endDaysAgoMin); - end = getTimeDaysAgo(region, startDaysAgoMax); + statsName = `${startDaysAgoMin} to ${endDaysAgoMax} days' statistics`; + evolutionName = `${startDaysAgoMin} to ${endDaysAgoMax} days' evolution`; + start = getTimeDaysAgo(region, endDaysAgoMax); + end = getTimeDaysAgo(region, startDaysAgoMin); } else { statsName = `${getPeriodOptionName(periodOption)} Statistics`; evolutionName = `${getPeriodOptionName(periodOption)} Evolution`; diff --git a/src/core/express/resolvePeriodFromURL.ts b/src/core/express/resolvePeriodFromURL.ts index 5f6242022..5fba7141f 100644 --- a/src/core/express/resolvePeriodFromURL.ts +++ b/src/core/express/resolvePeriodFromURL.ts @@ -24,13 +24,13 @@ export default function resolvePeriodFromURL( if (periodSubcommand === 'custom') { const startRaw = parseInt(url!.searchParams.get('start')!); const endRaw = parseInt(url!.searchParams.get('end')!); - const startMin = Math.min(startRaw, endRaw); - const endMax = Math.max(startRaw, endRaw); + const startDaysAgoMin = Math.min(startRaw, endRaw); + const endDaysAgoMax = Math.max(startRaw, endRaw); - statsName = `${startMin} to ${endMax} days' statistics`; - evolutionName = `${startMin} to ${endMax} days' evolution`; - start = getTimeDaysAgo(server, startMin); - end = getTimeDaysAgo(server, endMax); + statsName = `${startDaysAgoMin} to ${endDaysAgoMax} days' statistics`; + evolutionName = `${startDaysAgoMin} to ${endDaysAgoMax} days' evolution`; + start = getTimeDaysAgo(server, endDaysAgoMax); + end = getTimeDaysAgo(server, startDaysAgoMin); } else { statsName = `${getPeriodOptionName(periodOption)} Statistics`; evolutionName = `${getPeriodOptionName(periodOption)} Evolution`;