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.
29 lines
784 B
TypeScript
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,
|
|
};
|
|
}
|