mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 04:59:50 +01:00
fix: swapped min and max for start and end
This commit is contained in:
1 parent
8253c27333
commit
e806f0ede2
2 files changed
+11
-28
No files matched your search
@@ -17,7 +17,7 @@ export interface ResolvedPeriod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function resolvePeriodFromCommand(
|
export default function resolvePeriodFromCommand(
|
||||||
server: Region,
|
region: Region,
|
||||||
interaction: ChatInputCommandInteraction<CacheType>,
|
interaction: ChatInputCommandInteraction<CacheType>,
|
||||||
) {
|
) {
|
||||||
let statsName: string;
|
let statsName: string;
|
||||||
@@ -28,19 +28,19 @@ export default function resolvePeriodFromCommand(
|
|||||||
const periodOption = interaction.options.getString('period') as PeriodSize;
|
const periodOption = interaction.options.getString('period') as PeriodSize;
|
||||||
|
|
||||||
if (periodSubcommand === 'custom') {
|
if (periodSubcommand === 'custom') {
|
||||||
const startRaw = interaction.options.getInteger('start')!;
|
const startRaw = interaction.options.getInteger('start', true);
|
||||||
const endRaw = interaction.options.getInteger('end')!;
|
const endRaw = interaction.options.getInteger('end', true);
|
||||||
const startMin = Math.min(startRaw, endRaw);
|
const startDaysAgoMax = Math.min(startRaw, endRaw);
|
||||||
const endMax = Math.max(startRaw, endRaw);
|
const endDaysAgoMin = Math.max(startRaw, endRaw);
|
||||||
|
|
||||||
statsName = `${startMin} to ${endMax} days' statistics`;
|
statsName = `${startDaysAgoMax} to ${endDaysAgoMin} days' statistics`;
|
||||||
evolutionName = `${startMin} to ${endMax} days' evolution`;
|
evolutionName = `${startDaysAgoMax} to ${endDaysAgoMin} days' evolution`;
|
||||||
start = getTimeDaysAgo(server, startMin);
|
start = getTimeDaysAgo(region, endDaysAgoMin);
|
||||||
end = getTimeDaysAgo(server, endMax);
|
end = getTimeDaysAgo(region, startDaysAgoMax);
|
||||||
} else {
|
} else {
|
||||||
statsName = `${getPeriodOptionName(periodOption)} Statistics`;
|
statsName = `${getPeriodOptionName(periodOption)} Statistics`;
|
||||||
evolutionName = `${getPeriodOptionName(periodOption)} Evolution`;
|
evolutionName = `${getPeriodOptionName(periodOption)} Evolution`;
|
||||||
start = getPeriodStart(server, periodOption);
|
start = getPeriodStart(region, periodOption);
|
||||||
end = getPeriodNow();
|
end = getPeriodNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-18
@@ -2,14 +2,13 @@ import AllStatsOverview from '../components/AllStatsOverview';
|
|||||||
import NoData, { NoDataType } from '../components/NoData';
|
import NoData, { NoDataType } from '../components/NoData';
|
||||||
import PoweredBy, { PoweredByType } from '../components/PoweredBy';
|
import PoweredBy, { PoweredByType } from '../components/PoweredBy';
|
||||||
import { TreeTypeString } from '../components/Tanks';
|
import { TreeTypeString } from '../components/Tanks';
|
||||||
import { TierWeightsRecord } from '../components/TierWeights';
|
|
||||||
import TitleBar from '../components/TitleBar';
|
import TitleBar from '../components/TitleBar';
|
||||||
import Wrapper from '../components/Wrapper';
|
import Wrapper from '../components/Wrapper';
|
||||||
import calculateWN8 from '../core/blitz/calculateWN8';
|
import calculateWN8 from '../core/blitz/calculateWN8';
|
||||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
||||||
import resolveTankName from '../core/blitz/resolveTankName';
|
import resolveTankName from '../core/blitz/resolveTankName';
|
||||||
import sumStats from '../core/blitz/sumStats';
|
import sumStats from '../core/blitz/sumStats';
|
||||||
import { Tier, tankopedia } from '../core/blitz/tankopedia';
|
import { tankopedia } from '../core/blitz/tankopedia';
|
||||||
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
||||||
import { tankAverages } from '../core/blitzstars/tankAverages';
|
import { tankAverages } from '../core/blitzstars/tankAverages';
|
||||||
import { ResolvedPeriod } from '../core/discord/resolvePeriodFromCommand';
|
import { ResolvedPeriod } from '../core/discord/resolvePeriodFromCommand';
|
||||||
@@ -67,7 +66,6 @@ export default async function stats<Type extends StatType>(
|
|||||||
const awaitedTankopedia = await tankopedia;
|
const awaitedTankopedia = await tankopedia;
|
||||||
let stats: AllStats | undefined;
|
let stats: AllStats | undefined;
|
||||||
let supplementaryStats: SupplementaryStats;
|
let supplementaryStats: SupplementaryStats;
|
||||||
let tierWeights: TierWeightsRecord;
|
|
||||||
|
|
||||||
if (type === 'player' || type === 'multi-tank') {
|
if (type === 'player' || type === 'multi-tank') {
|
||||||
const typedFilters = filters as Partial<MultiTankFilters> | null;
|
const typedFilters = filters as Partial<MultiTankFilters> | null;
|
||||||
@@ -124,21 +122,6 @@ export default async function stats<Type extends StatType>(
|
|||||||
0,
|
0,
|
||||||
) / battlesOfTanksWithTankopediaEntry,
|
) / battlesOfTanksWithTankopediaEntry,
|
||||||
};
|
};
|
||||||
tierWeights = filteredOrder.reduce<TierWeightsRecord>((accumulator, id) => {
|
|
||||||
const tankopediaEntry = awaitedTankopedia[id];
|
|
||||||
|
|
||||||
if (!tankopediaEntry) return accumulator;
|
|
||||||
|
|
||||||
const tier = tankopediaEntry.tier as Tier;
|
|
||||||
|
|
||||||
if (accumulator[tier]) {
|
|
||||||
accumulator[tier]! += diffed[id].battles;
|
|
||||||
} else {
|
|
||||||
accumulator[tier] = diffed[id].battles;
|
|
||||||
}
|
|
||||||
|
|
||||||
return accumulator;
|
|
||||||
}, {});
|
|
||||||
} else {
|
} else {
|
||||||
stats = diffed[(filters as number)!];
|
stats = diffed[(filters as number)!];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user