Skip to content

Sistema de Matchmaking

Sebastian Galindo edited this page Jan 14, 2026 · 6 revisions

Crear un arbol de matchmaking

sequenceDiagram
    autonumber
    participant post as POST /matchmaking/create
    participant matchmaking as Matchmaking Handler
    participant participation as Participation Handler
    participant DB as Mongo
    post->>+matchmaking: call
    matchmaking->>+participation: getParticipationByContestId()
    participation-->>-matchmaking: participation[]
    matchmaking->>matchmaking: makeMatches()
    matchmaking->>+DB: createRank()
    DB-->>-matchmaking: ack
    matchmaking-->>-post: return
Loading

Crear un resultado de un match

sequenceDiagram
    autonumber
    participant API as POST /results/create
    participant RH as Results Handler
    participant MH as Matchmaking Handler
    participant CTM as Contest Tree Manager
    participant SB as Supabase
    participant MG as Mongo

    API->>+RH: 
    RH->>+MH: setResult()
    MH->>+CTM: getTreeByContest()
    CTM-->>-MH: tree

    rect rgb(30, 30, 30)
        Note over MH, MG: result transaction
        MH->>MH: createResultInTree()
        MH->>+SB: createResult()
        SB-->>-MH: ack
        MH->>+MG: updateTree()
        MG-->>-MH: ack
    end
    MH-->>-RH: ack
    RH-->>-API: ack
Loading

Contest tree manager

sequenceDiagram
    autonumber
    participant S as System
    participant CTM as Contest Tree Manager
    participant M as Mongo

    S->>+CTM: getTreeByContest()
    
    alt if tree is in memory
        CTM-->>S: tree
    else else
        CTM->>+M: getTreeByContest()
        M-->>-CTM: tree
        CTM-->>-S: tree
    end
Loading

Clone this wiki locally