22 lines
825 B
TypeScript
22 lines
825 B
TypeScript
/**
|
|
* Return participantIds from allParticipantIds that have no entry
|
|
* in existingResultParticipantIds. Used to find participants who
|
|
* need a 0-QP row after a qualifying event is finalized.
|
|
*/
|
|
export function findParticipantsWithoutResults(
|
|
allParticipantIds: string[],
|
|
existingResultParticipantIds: Set<string>
|
|
): string[] {
|
|
return allParticipantIds.filter((id) => !existingResultParticipantIds.has(id));
|
|
}
|
|
|
|
/**
|
|
* Filter incoming batch results to only those whose participantId
|
|
* is not already in the set of existing result participantIds.
|
|
*/
|
|
export function filterNewResults(
|
|
incoming: { participantId: string; placement: number }[],
|
|
existingParticipantIds: Set<string>
|
|
): { participantId: string; placement: number }[] {
|
|
return incoming.filter((r) => !existingParticipantIds.has(r.participantId));
|
|
}
|