Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Each league/tournament/etc allocates sequences of game numbers to each schedule

  • Game numbers are only unique within each schedule and may be reused in other schedules

  • Game numbers often have a prefix and suffix to identify which league and category

  • A schedule with groups/flights will have a sequences per group (flight 1 will have 1000-1999, flight 2 will have 2000-2999, etc within the same U13 schedule)

  • Draft games can be Games should have their numbers resorted sorted based on the date/time at time prior to of publishing, but and published games cannot be resorted

...

  • re-sorted

    • Draft games do not use sequences

Existing behaviour

Currently we have a (published) games table and a drafts table, where drafts essentially act as isolated containers of a schedule.

...

When creating drafts, you can must specify a starting game number, which will automatically increment within the draft, with an option to resort the numbers. re-number the games (sorted by date). The draft’s starting game number option only exists within the draft, and ceases to exist once the draft is published.

When publishing the draft, if a draft game matches the game number of a published game, the published game will be updated instead of creating a new game. This starting game number option only exists within the draft, and ceases to exist once the draft is published.

Proposed behaviour

Following the implementation of SPR-453 Draft Redesign, there will be two game tables will exist: Game (published) and DraftGame (unpublished), and the . The original Draft table that creates an isolated container effect will no longer continue to exist. Sequences (this proposal) are necessary to introduce to maintain the original start number draft option functionality.

Sequences

A sequence will be composed of a starting number (which may have a prefix/suffix matching the regex format regular expression /^(.*?)(\d+)(\D*)$/) and a maximum range.

This is modelled after Postgres sequences, which also have a optional increment property which could allow you to increment allows keeping track of the next number in the sequence by more than 1 at a time (so a sequence of 1, 3, 5 if you wanted or 10, 20, 30, etc) but this has not been identified as a requirement. So this sequence within limits. This would allow you to create a sequence with a starting number of U13L1000 which increments by 1 up to U13L1999.

Creating a sequence must validate if the range overlaps with any existing sequences to avoid creating conflicts. A new sequence must throw a validation error if the maximum causes an overlap into another sequence in the schedule.

Scheduling

Creating a game, regardless of whether it’s published directly or a draft game, will pull the next sequence number available. Drafts will require sequences to be configured in the schedule as draft games cannot rely on the game ID sequence

Draft games will use temporary IDs as identifiers until they are published. There is no need to renumber these while they’re a draft as they will be numbered in the correct order upon publishing. This also avoids a situation where there’s a publicly perceived gap in the schedule numbering because that gap is used by draft games. This also avoids needing to edit a sequence after draft games have been deleted and need to be recreated.

If the next sequenced number already exists for whatever reason (e.g., that number was manually provided when creating a game or in case of an error updating the sequence), another the next available sequence number will be produced until a non-conflicting number is available.

It is possible to reset a sequence back to a given starting number, which may be necessary in case a batch of games are deleted. Resets will never be done automatically as we cannot predict if the user wants to reuse the sequence or not.

It will If a numbering sequence exists in the schedule, the user is not given the option to manually enter or change game numbers in the schedule as they will be automated. This will prevent potential user errors.

When a game is deleted, that number in the sequence will not be reused, despite leaving a gap in numbering.

If the applicable sequence is exhausted, then games cannot be created and drafts cannot be published until this is resolved.

Groups

If a schedule has no groups, it is limited to one sequence for the schedule. If a schedule has groups, it is limited to one group per sequence.

1001-1299 = Flight 1
1300-1599 = Flight 2
1600-1899 = Flight 3
1900-2199 = Flight 4

When scheduling cross-group games, the game number is always taken from the sequence of the home team. While it is possible for a team to be in multiple groups in the same schedule (e.g., PCAHA playoffs), when generating the schedule, we select the groups, so this is how we can disambiguate the groups.

If necessary, it can also be possible to produce multiple sequences, so that you can have multiple sets of sequences as necessary. The sequence with the lowest next number that has not been exhausted will be used to produce the next sequence.

If all sequences are exhausted, published games will fall back to using game IDs if there are no viable sequences available, and draft games will fail to produce.

Potential concerns

Assuming a sequence of U13L1000-1999 for simplicity of explanation:

...

It will be possible for someone to create a published game, which would use U13L1000, then generate 100 draft games which would be numbered U13L1001 through U13L1100. Before publishing these draft games, someone could create a new published game, which would use U13L1101 as the next number in the sequence.

  • At this point there are only 2 published games, 1000 and 1101, while 1001-1100 are unpublished.

  • Likewise, if you were to create another draft game at this point, the next draft game number would be U13L1102.

Deleting a game would create a gap in the sequence. Should this gap be automatically identified and reused or ignored?

You could publish games 12000 through 1299 and then delete 1250. If you generate 3 additional games, should the next games be numbered as:

...

1250, 1300, 1301, or

...

However, this is unlikely necessary and will not be allowed initially to avoid potential user error.

Exceptions

It will be possible to manually reset a sequence back to a given starting number, which may be necessary in case a batch of games are deleted. Resets will never be done automatically as we cannot predict if the user wants to reuse the sequence or not. All games in the schedule must be deleted in order for the reset to be available.

Once all sequences are exhausted, a validation error will prevent games from being created or draft games from being published until a viable sequence is available. We cannot fall back to a game ID as that would be a bigger mess to clean up, and it would be easier to block publishing so that they can fix the sequence then resume publishing.

Examples

PCAHA game numbering system is well defined:

View file
nameG-Standardized Game Number System (2).pdf