|
@@ -148,17 +148,17 @@ export default class MariadbConnector {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async getNonFinishedGamesForPlayer(username) {
|
|
|
+ async getJoinableGamesForPlayer(username) {
|
|
|
|
|
|
let conn;
|
|
|
let games = [];
|
|
|
try {
|
|
|
conn = await this.pool.getConnection();
|
|
|
const res = await conn.query(
|
|
|
- "SELECT * FROM`games` WHERE status != 'FINISHED' AND(player1 = ? OR player2 = '' OR player2 = ?)",
|
|
|
+ "SELECT * FROM`games` WHERE (status = 'CREATED' OR status = 'PAUSED') AND(player1 = ? OR player2 = '' OR player2 = ?)",
|
|
|
[username,username]);
|
|
|
- for (const { player1,player2,deck,adv_rules } of res) {
|
|
|
- games.push({player1,player2,deck,adv_rules});
|
|
|
+ for (const { id,player1,player2,deck,adv_rules } of res) {
|
|
|
+ games.push({id,player1,player2,deck,adv_rules});
|
|
|
}
|
|
|
console.log(`returning for ${username} : `, games);
|
|
|
} finally {
|