mirror of
https://github.com/anatolykopyl/vk-bingo.git
synced 2026-03-26 12:54:25 +00:00
Fix answer counting
This commit is contained in:
@@ -8,7 +8,7 @@ import { createNanoEvents } from 'nanoevents';
|
||||
|
||||
import "dotenv/config";
|
||||
|
||||
import names from './names.json' assert { type: "json" };
|
||||
import names from './names'
|
||||
|
||||
const app = express();
|
||||
|
||||
@@ -175,6 +175,7 @@ const client = new MongoClient(process.env.URI, { useUnifiedTopology: true });
|
||||
});
|
||||
|
||||
players[req.body.data.username] = req.body.data.name;
|
||||
answers += 1
|
||||
emitter.emit('answer', {
|
||||
username: req.body.data.username,
|
||||
selected: req.body.data.name
|
||||
@@ -283,8 +284,6 @@ const client = new MongoClient(process.env.URI, { useUnifiedTopology: true });
|
||||
|
||||
res.write(`data: ${JSON.stringify(data)}\nevent: answer\n\n`);
|
||||
|
||||
answers += 1
|
||||
|
||||
if (answers === Object.keys(players).length) {
|
||||
Object.keys(players).forEach((key) => {
|
||||
if (card.name === players[key]) {
|
||||
|
||||
Reference in New Issue
Block a user