Scoring Policy
The Scoring Policy (POLICY_TYPE_SCORING) controls scoring requirements, format restrictions, deletion permissions, and change propagation behaviors. This policy ensures data integrity and enforces tournament-specific scoring rules.
Policy Type: scoring
When to Use:
- Enforcing participant presence requirements for scoring
- Controlling when draws/structures can be deleted
- Restricting available matchUp formats
- Requiring all positions assigned before scoring
- Defining matchUpStatus code interpretations
- Managing score change propagation
- Setting default matchUp formats
Policy Structure
{
scoring: {
policyName?: string; // Optional policy identifier
// Default format for all matchUps
defaultMatchUpFormat?: string; // e.g., 'SET3-S:6/TB7'
// Deletion permissions when scores exist
allowDeletionWithScoresPresent?: {
drawDefinitions: boolean; // Allow draw deletion (default: false)
structures: boolean; // Allow structure deletion (default: false)
};
// Scoring requirements
requireParticipantsForScoring?: boolean; // Both participants must be present (default: false)
requireAllPositionsAssigned?: boolean | undefined; // All positions assigned before scoring (default: undefined = true)
// Change propagation
allowChangePropagation?: boolean; // Propagate winningSide changes downstream (default: false)
// Stage-specific requirements
stage?: {
[stageName: string]: {
stageSequence?: {
[sequence: number]: {
requireAllPositionsAssigned?: boolean; // Override for specific stage/sequence
};
};
};
};
// Available matchUp formats
matchUpFormats?: Array<{
matchUpFormat: string; // Format code
description?: string; // Human-readable description
categoryNames?: string[]; // Applicable categories
categoryTypes?: string[]; // Applicable category types
}>;
// Status code refinements
matchUpStatusCodes?: {
[status: string]: Array<{
matchUpStatusCode: string; // Code identifier
matchUpStatusCodeDisplay: string; // Display text
label: string; // User-facing label
description?: string; // Detailed explanation
}>;
};
// Process codes for specific scenarios
processCodes?: {
incompleteAssignmentsOnDefault?: string[]; // Codes applied on default (e.g., ['RANKING.IGNORE'])
};
}
}
Default Scoring Policy
import { POLICY_SCORING_DEFAULT } from 'tods-competition-factory';
// Defaults:
// {
// scoring: {
// defaultMatchUpFormat: 'SET3-S:6/TB7', // Standard format
// allowDeletionWithScoresPresent: {
// drawDefinitions: false, // Cannot delete draws with scores
// structures: false // Cannot delete structures with scores
// },
// requireParticipantsForScoring: false, // Participants not required
// requireAllPositionsAssigned: undefined, // Defaults to true for MAIN stage
// allowChangePropagation: false, // No automatic propagation
// stage: {
// MAIN: {
// stageSequence: {
// 1: { requireAllPositionsAssigned: true } // Main draw must be complete
// }
// }
// },
// matchUpFormats: [], // No format restrictions
// matchUpStatusCodes: { // Empty status codes
// ABANDONED: [],
// CANCELLED: [],
// DEFAULTED: [],
// INCOMPLETE: [],
// RETIRED: [],
// WALKOVER: []
// },
// processCodes: {
// incompleteAssignmentsOnDefault: ['RANKING.IGNORE']
// }
// }
// }