Class Reset

Hierarchy

  • BaseUpdater
    • Reset

Constructors

  • Creates an instance of a Storage getter.

    Parameters

    • storage: Storage

      The implementation of Storage.

    Returns Reset

Properties

storage: Storage

Methods

  • Updates the opponents and status of a match and its child games.

    Parameters

    • match: Match

      A match.

    Returns Promise<void>

  • Applies a SetNextOpponent function to matches following the current match.

    • nextMatches[0] is assumed to be next match for the winner of the current match.
    • nextMatches[1] is assumed to be next match for the loser of the current match.

    Parameters

    • setNextOpponent: SetNextOpponent

      The SetNextOpponent function.

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • roundNumber: number

      Number of the current round.

    • roundCount: number

      Count of rounds.

    • nextMatches: (null | Match)[]

      The matches following the current match.

    • Optional winnerSide: Side

      Side of the winner in the current match.

      Optional

    Returns Promise<void>

  • Sets the status of a list of matches to archived.

    Parameters

    • matches: Match[]

      The matches to update.

    Returns Promise<void>

  • Confirms the current seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<void>

  • Finds a match in a given group. The match must have the given number in a round of which the number in group is given.

    Example: In group of id 1, give me the 4th match in the 3rd round.

    Parameters

    • groupId: Id

      ID of the group.

    • roundNumber: number

      Number of the round in its parent group.

    • matchNumber: number

      Number of the match in its parent round.

    Returns Promise<Match>

  • Finds a match game based on its id or based on the combination of its parent_id and number.

    Parameters

    • game: {
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          parent_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Values to change in a match game.

      • Optional id?: Id

        ID of the match game.

      • Optional number?: number

        The number of the match game in its parent match.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional parent_id?: Id

        ID of the parent match.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    Returns Promise<MatchGame>

  • Gets the loser bracket.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<null | Group>

  • Gets the match(es) where the opponents of the current match will go just after.

    Parameters

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      The number of the current round.

    • roundCount: number

      Count of rounds.

    Returns Promise<(null | Match)[]>

  • Gets all the rounds that contain ordered participants.

    Parameters

    • stage: Stage

      The stage to get rounds from.

    Returns Promise<Round[]>

  • Gets the matches leading to the given match.

    Parameters

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    Returns Promise<Match[]>

  • Gets the positional information (number in group and total number of rounds in group) of a round based on its id.

    Parameters

    • roundId: Id

      ID of the round.

    Returns Promise<RoundPositionalInfo>

  • Returns the matches which contain the seeding of a stage based on its type.

    Parameters

    • stageId: Id

      ID of the stage.

    • stageType: StageType

      The type of the stage.

    Returns Promise<null | Match[]>

  • Gets the upper bracket (the only bracket if single elimination or the winner bracket in double elimination).

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<Group>

  • Resets the results of a match game.

    Parameters

    • gameId: Id

      ID of the match game.

    Returns Promise<void>

  • Resets the results of a match: the match status, and each opponent's forfeit and result properties.

    After resetting the results, you can update the match scores and complete the match again.

    This will update related matches accordingly.

    Parameters

    • matchId: Id

      ID of the match.

    Returns Promise<void>

  • Propagates winner against BYEs in related matches.

    Parameters

    • match: Match

      The current match.

    Returns Promise<void>

  • Resets the status of a list of matches to what it should currently be.

    Parameters

    • matches: Match[]

      The matches to update.

    Returns Promise<void>

  • Resets the seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<void>

  • Updates a match based on a partial match.

    Parameters

    • stored: Match

      A reference to what will be updated in the storage.

    • match: {
          child_count?: number;
          group_id?: Id;
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          round_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Input of the update.

      • Optional child_count?: number

        The count of match games this match has. Can be 0 if it's a simple match, or a positive number for "Best Of" matches.

      • Optional group_id?: Id

        ID of the parent group.

      • Optional id?: Id

        ID of the match.

      • Optional number?: number

        The number of the match in its round.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional round_id?: Id

        ID of the parent round.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    • Optional force: boolean

      Whether to force update locked matches.

      Optional

    Returns Promise<void>

  • Updates a match game based on a partial match game.

    Parameters

    • stored: MatchGame

      A reference to what will be updated in the storage.

    • game: {
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          parent_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Input of the update.

      • Optional id?: Id

        ID of the match game.

      • Optional number?: number

        The number of the match game in its parent match.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional parent_id?: Id

        ID of the parent match.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    Returns Promise<void>

  • Updates the match(es) following the current match based on this match results.

    Parameters

    • match: Match

      Input of the update.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    • roundCount: number

      Count of rounds.

    Returns Promise<void>

  • Updates a parent match based on its child games.

    Parameters

    • parentId: Id

      ID of the parent match.

    • inRoundRobin: boolean

      Indicates whether the parent match is in a round-robin stage.

    Returns Promise<void>

  • Updates the match(es) leading to the current match based on this match results.

    Parameters

    • match: Match

      Input of the update.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    Returns Promise<void>

  • Updates the matches related (previous and next) to a match.

    Parameters

    • match: Match

      A match.

    • updatePrevious: boolean

      Whether to update the previous matches.

    • updateNext: boolean

      Whether to update the next matches.

    Returns Promise<void>

  • Updates or resets the seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    • seeding: {
          seeding?: null | Seeding;
          seedingIds?: null | IdSeeding;
      }

      A new seeding or null to reset the existing seeding.

      • Optional seeding?: null | Seeding

        Can contain names, IDs or BYEs.

      • Optional seedingIds?: null | IdSeeding

        Can only contain IDs or BYEs.

    • keepSameSize: boolean

      Whether to keep the same size as before for the stage.

    Returns Promise<void>

  • Throws an error if a match is locked and the new seeding will change this match's participants.

    Parameters

    • matches: Match[]

      The matches stored in the database.

    • slots: ParticipantSlot[]

      The slots to check from the new seeding.

    Returns void

  • Returns the good seeding ordering based on the stage's type.

    Parameters

    • stageType: StageType

      The type of the stage.

    • create: StageCreator

      A reference to a Create instance.

    Returns SeedOrdering

Generated using TypeDoc