fix: swapped start and end min and max

This commit is contained in:
TresAbhi committed 2023-08-09 17:56:35 +00:00
1 parent e806f0ede2
commit d448101b32
2 files changed
+12 -12

No files matched your search

+6 -6
View File
@@ -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`;
+6 -6
View File
@@ -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`;