Ignore:
Timestamp:
07/07/22 23:53:57 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
95ce58b
Parents:
189cd8f
Message:

Fixes to poker functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/api/poker/index.js

    r189cd8f raac3b2b  
    4747            },
    4848        }],
     49        onlyOnePlayerLeft: false,
    4950        winners: [],
    5051        splitWinners: false,
     
    281282            const { success, table } = getTableAndPlayer(req.query.session_id)
    282283
    283             if (success && !table.started) {
     284            if (success && !table.started && !table.ended && table.players.filter(e=>e.isSatDown===true).length >= 2) {
    284285                table.players.forEach(player => {
    285286                    axios.get(`${process.env.HOME_URL}/api/postgre/?action=check_if_logged_in&session_id=${player.id}`).then(postgreRes => {
     
    342343                player.isFolded = true;
    343344
    344                 if (table.players[table.turnIdx] !== undefined && table.players[table.turnIdx] === player) {
    345                     setNextPlayerIdx(table.id);
     345                if (table.started) {
     346                    if (table.players[table.turnIdx] !== undefined && table.players[table.turnIdx] === player) {
     347                        setNextPlayerIdx(table.id);
     348                    }
     349                }
     350                else {
     351                    table.players = table.players.filter(e=>e.isGhost === false);
    346352                }
    347353            }
Note: See TracChangeset for help on using the changeset viewer.