Changeset ace7865 for pages/api/postgre


Ignore:
Timestamp:
06/25/22 11:30:19 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
b13f93b
Parents:
9bd09b0
Message:

Finished Roulette

File:
1 edited

Legend:

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

    r9bd09b0 race7865  
    6666                else if (req.query?.outcome === 'dealer_busted' || req.query?.outcome === 'player_won') {
    6767                  pool.query('UPDATE stats SET blackjack_games = $1, blackjack_won_games = $2 WHERE username = $3', [parseInt(stats.blackjack_games) + 1, parseInt(stats.blackjack_won_games) + 1, session.username], (error, results) => {
     68                    if (error) throw error;
     69                  });
     70                }
     71              }
     72              else if (req.query?.game === 'roulette') {
     73                if (req.query?.outcome === 'lost') {
     74                  pool.query('UPDATE stats SET roulette_games = $1 WHERE username = $2', [parseInt(stats.roulette_games) + 1, session.username], (error, results) => {
     75                    if (error) throw error;
     76                  });
     77                }
     78                else if (req.query?.outcome === 'won') {
     79                  pool.query('UPDATE stats SET roulette_games = $1, roulette_won_games = $2 WHERE username = $3', [parseInt(stats.roulette_games) + 1, parseInt(stats.roulette_won_games) + 1, session.username], (error, results) => {
    6880                    if (error) throw error;
    6981                  });
Note: See TracChangeset for help on using the changeset viewer.