Ignore:
Timestamp:
07/18/22 13:59:55 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
22367db
Parents:
e903234
Message:

Ability for admin to watch live games and for user to see games history

File:
1 edited

Legend:

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

    re903234 rfaff334  
    66import { calculateEarnings, calculateSideBetEarnings } from './calculateEarnings';
    77
    8 import { rooms, update_rooms_to_database } from '../postgre/index'
     8import { rooms, saveGameInHistory, update_rooms_to_database } from '../postgre/index'
    99
    1010/**
     
    3737
    3838      if (rooms[session_id] !== undefined && rooms[session_id].status.substr(1, 1) === '5') {
    39         rooms[session_id] = {...game, playerCards: [...game.playerCards], dealerCards: [...game.dealerCards]};
     39        rooms[session_id] = {...game, displayName: rooms[session_id].displayName, username: rooms[session_id].username, playerCards: [...game.playerCards], dealerCards: [...game.dealerCards]};
    4040
    4141        rooms[session_id].betOutcomeMessageShown = true;
     
    141141          }
    142142        });
     143
     144        saveGameInHistory('blackjack', rooms[session_id], rooms[session_id].username);
    143145
    144146        return ;
     
    201203            }
    202204          });
     205         
     206          saveGameInHistory('blackjack', rooms[session_id], rooms[session_id].username);
    203207        }
    204208        else {
Note: See TracChangeset for help on using the changeset viewer.