Files
lolympus-tournament-support/apps/api/src/modules/riot/riot-multi-kill.ts
T
dahyeon 0d7617e2d2 feat: connect tournament views to APIs and recover archived stats
Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration.

Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive.

Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
2026-11-11 02:00:35 +09:00

29 lines
784 B
TypeScript

import type { RiotMatchParticipantDto } from './riot.types';
export function readMultiKills(participant?: RiotMatchParticipantDto) {
if (!participant) return undefined;
const count = (key: string) => {
const value = participant[key];
return typeof value === 'number' && Number.isInteger(value) && value > 0
? value
: 0;
};
const doubleKills = count('doubleKills');
const tripleKills = count('tripleKills');
const quadraKills = count('quadraKills');
const pentaKills = count('pentaKills');
const largestMultiKill = Math.max(
count('largestMultiKill'),
pentaKills ? 5 : quadraKills ? 4 : tripleKills ? 3 : doubleKills ? 2 : 0,
);
return {
doubleKills,
tripleKills,
quadraKills,
pentaKills,
largestMultiKill,
};
}