Code Monkey home page Code Monkey logo

brackets-model's Introduction

Corentin Girard (Drarig29)

overview languages

brackets-model's People

Contributors

drarig29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

duantranhuy

brackets-model's Issues

Add `stage_id` in match games

This reference would allow someone to retrieve all the match games of a stage.

Especially in manager.get.stageData(), getting match games without stage_id would return every match game in the storage, which is overkill if there are multiple stages.

No need for other id references (group_id, round_id).

Clean up data interface

Some data won't be used after all.

  • A group's name is currently used to know if it's a winner or loser bracket but that could be found with its number property
  • All time data won't be used in either the manager or the viewer

Move `Table` and `CrudInterface` types here

The libraries from https://github.com/Drarig29/brackets-storage should not need to rely on brackets-manager's types.

Also, the CrudInterface that would be exported from brackets-model should be way simpler than the ones in the brackets-manager: it should not rely on DataTypes at all, and be "dumber".

This would keep the same amount of boilerplate type generics in storage implementations.

Group and Round connection.

Hello, what is the algorithm to create Groups for Round objects? I found this types, but I have no idea how many Groups do I need to display tournament grid.

/**
 * A group of a stage.
 */
export interface Group {
    /** ID of the group. */
    id: number,

    /** ID of the parent stage. */
    stage_id: number,

    /** The number of the group in its stage. */
    number: number,
}

/**
 * A round of a group.
 */
export interface Round {
    /** ID of the round. */
    id: number,

    /** ID of the parent stage. */
    stage_id: number,

    /** ID of the parent group. */
    group_id: number,

    /** The number of the round in its group. */
    number: number,
}

Seeding with `CustomParticipant` not possible in TypeScript

When trying to create a Stage with Seeding the same way as in custom.spec.js#L16 TypeScripts errors.

This is due to the fact that a CustomParticipant also requires to have the Participant field, namingly id and tournament_id. I am not sure if this is intentional or not. Else I would propose something like this:

/**
 * The seeding for a stage.
 *
 * Each element represents a participant, which can be:
 * - A full object, with possibly extra fields.
 * - Its name.
 * - Its ID.
 * - Or a BYE: `null`.
 */
export type Seeding<Participant extends Partial<CustomParticipant> = CustomParticipant> = (Participant | string | number | null)[];

/**
 * Used to create a stage.
 */
export interface InputStage<Participant extends Partial<CustomParticipant> = Partial<CustomParticipant>> {
    /**
     * ID of the parent tournament.
     *
     * Used to determine the `number` property of a stage related to a tournament.
     */
    tournamentId: number;
    /** Name of the stage. */
    name: string;
    /** Type of stage. */
    type: StageType;
    /** The number of the stage in its tournament. Is determined if not given. */
    number?: number;
    /** Contains participants or `null` for BYEs. */
    seeding?: Seeding<Participant>;
    /** Contains optional settings specific to each stage type. */
    settings?: StageSettings;
}

Participant more data

participant should be able to hold at least an external_id if you want to reference to other systems and set more data based on it.
I would also like some additional fields like an image, a website and an identifier which marks the team as internal if you have tuniers and want your team to have a custom border or such.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.