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]) {
|
||||
|
||||
11
backend/names.js
Normal file
11
backend/names.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export default [
|
||||
"Толя Копыл",
|
||||
"Дмитрий Самойлов",
|
||||
"Илья Усачев",
|
||||
"Степан Якимушкин",
|
||||
"Ваня Гребнев",
|
||||
"Алексей Петров",
|
||||
"Алексей Иванов",
|
||||
"Глеб Гейнке",
|
||||
"Иван Чех"
|
||||
]
|
||||
@@ -1,4 +1,4 @@
|
||||
[
|
||||
export default [
|
||||
"Участник Беседы 1",
|
||||
"Участник Беседы 2",
|
||||
"Участник Беседы 3"
|
||||
@@ -23,6 +23,7 @@
|
||||
{{ user.name }}
|
||||
</span>
|
||||
<span
|
||||
v-if="score[user.name]"
|
||||
class="score"
|
||||
:class="{
|
||||
'-leader': leader === user.name
|
||||
@@ -52,6 +53,7 @@
|
||||
{{ user.name }}
|
||||
</span>
|
||||
<span
|
||||
v-if="score[user.name]"
|
||||
class="score"
|
||||
:class="{
|
||||
'-leader': leader === user.name
|
||||
|
||||
Reference in New Issue
Block a user