UNPKG

@lovebowls/leagueelements

Version:

League Elements package for LoveBowls

64 lines 2.94 kB
export class League { /** * Create a new League * @param {Object} data - League data */ constructor(data: Object); _id: any; name: any; settings: { pointsForWin: any; pointsForDraw: any; pointsForLoss: any; promotionPositions: any; relegationPositions: any; timesTeamsPlayOther: any; }; teams: any; matches: any; createdAt: any; updatedAt: any; /** * Add a team to the league */ addTeam(team: any): boolean; /** * Add a match to the league */ addMatch(match: any): boolean; /** * Initialise fixtures for the league using a round-robin algorithm. * Each team plays once per match day. Fixtures are scheduled according to the provided scheduling parameters. * Teams will play each other `this.settings.timesTeamsPlayOther` times, with home and away fixtures balanced * as per the cycles of the round-robin generation (e.g., first cycle A vs B, second cycle B vs A). * * @param {Date} [startDate] - The start date for the first round of matches. If null, matches will have null dates. * @param {Object} [schedulingParams] - Advanced scheduling parameters * @param {string} [schedulingParams.schedulingPattern='interval'] - 'interval' or 'dayOfWeek' * @param {number} [schedulingParams.intervalNumber=1] - Number of interval units between match days * @param {string} [schedulingParams.intervalUnit='weeks'] - 'days' or 'weeks' * @param {Array<number>} [schedulingParams.selectedDays] - Array of day numbers (0=Sunday, 1=Monday, etc.) for dayOfWeek pattern * @param {number} [schedulingParams.maxMatchesPerDay] - Maximum matches per day (optional) * @returns {boolean} - True if fixtures were successfully created, false if there are fewer than 2 teams or if a match fails to be added. */ initialiseFixtures(startDate?: Date, schedulingParams?: { schedulingPattern?: string | undefined; intervalNumber?: number | undefined; intervalUnit?: string | undefined; selectedDays?: number[] | undefined; maxMatchesPerDay?: number | undefined; }): boolean; /** * Private helper method to assign dates to matches based on scheduling parameters */ _assignMatchDates(allMatches: any, startDate: any, schedulingPattern: any, intervalNumber: any, intervalUnit: any, selectedDays: any, maxMatchesPerDay: any): false | undefined; /** * Find the next valid date based on scheduling pattern */ _findNextValidDate(fromDate: any, schedulingPattern: any, intervalNumber: any, intervalUnit: any, selectedDays: any): Date; /** * Get the next scheduling date after a match date */ _getNextSchedulingDate(currentDate: any, schedulingPattern: any, intervalNumber: any, intervalUnit: any, selectedDays: any): Date; } //# sourceMappingURL=dummy-league.d.ts.map