Skip to content

Commit

Permalink
Update để sửa console.log cho hợp lý
Browse files Browse the repository at this point in the history
  • Loading branch information
maik205 committed Feb 5, 2022
1 parent 792a230 commit e6800c8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 74 deletions.
2 changes: 1 addition & 1 deletion match_data/123.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"socketID":"obk1htvh04","matchName":"HUYỀN THOẠI VUA HÙNG IV - CHUNG KẾT","matchPos":"VD","players":[{"id":1,"name":"Nguyễn Văn A","score":0,"isReady":true},{"id":2,"name":"Nguyen Van B","score":0,"isReady":false},{"id":3,"name":"Nguyen Van C","score":0,"isReady":false},{"id":4,"name":"Nguyễn Văn D","score":0,"isReady":true}],"KDFilePath":"match_data/round_data/kd_1.json","VCNVFilePath":"match_data/round_data/vcnv_1.json","TangTocFilePath":"match_data/round_data/tt_1.json","VedichFilePath":"match_data/round_data/vd_1.json","pauseTime":46}
{"socketID":"obk1htvh04","matchName":"HUYỀN THOẠI VUA HÙNG IV - CHUNG KẾT","matchPos":"VD","players":[{"id":1,"name":"Nguyễn Văn A","score":70,"isReady":true},{"id":2,"name":"Nguyen Van B","score":0,"isReady":false},{"id":3,"name":"Nguyen Van C","score":0,"isReady":false},{"id":4,"name":"Nguyễn Văn D","score":0,"isReady":true}],"KDFilePath":"match_data/round_data/kd_1.json","VCNVFilePath":"match_data/round_data/vcnv_1.json","TangTocFilePath":"match_data/round_data/tt_1.json","VedichFilePath":"match_data/round_data/vd_1.json","pauseTime":46}
70 changes: 1 addition & 69 deletions match_data/round_data/tt_1.json
Original file line number Diff line number Diff line change
@@ -1,69 +1 @@
{
"questions": [
{
"id": 1,
"question": "Tìm M",
"answer": "24",
"type": "TT_IMG",
"question_image": "1.png",
"answer_image": "2.png"
},
{
"id": 2,
"question": "Sắp xếp các hình ảnh theo đúng thứ tự",
"answer": "BCED",
"type": "TT_IMG",
"question_image": "3.png",
"answer_image": "4.png"
},
{
"id": 3,
"question": "Tìm hình thích hợp điền vào vị trí của X",
"answer": "B",
"type": "TT_IMG",
"question_image": "5.png",
"answer_image": "6.png"
},
{
"id": 4,
"question": "Đây là địa danh nào",
"answer": "Vũng Tàu",
"type": "TT_VD",
"video_name": "1.mp4"
}
],
"playerAnswers": [
{
"id": 1,
"answer": "",
"timestamp": 0,
"readableTime": "",
"correct": false
},
{
"id": 2,
"answer": "",
"timestamp": 0,
"readableTime": "",
"correct": false
},
{
"id": 3,
"answer": "",
"timestamp": 0,
"readableTime": "",
"correct": false
},
{
"id": 4,
"answer": "",
"timestamp": 0,
"readableTime": "",
"correct": false
}
],
"showResults": true,
"currentQuestion": -1,
"showAnswer": false,
"timerStartTimestamp": 1643981927990
}
{"questions":[{"id":1,"question":"Tìm M","answer":"24","type":"TT_IMG","question_image":"1.png","answer_image":"2.png"},{"id":2,"question":"Sắp xếp các hình ảnh theo đúng thứ tự","answer":"BCED","type":"TT_IMG","question_image":"3.png","answer_image":"4.png"},{"id":3,"question":"Tìm hình thích hợp điền vào vị trí của X","answer":"B","type":"TT_IMG","question_image":"5.png","answer_image":"6.png"},{"id":4,"question":"Đây là địa danh nào","answer":"Vũng Tàu","type":"TT_VD","video_name":"1.mp4"}],"playerAnswers":[{"id":1,"answer":"","timestamp":0,"readableTime":"","correct":false},{"id":2,"answer":"","timestamp":0,"readableTime":"","correct":false},{"id":3,"answer":"","timestamp":0,"readableTime":"","correct":false},{"id":4,"answer":"","timestamp":0,"readableTime":"","correct":false}],"showResults":true,"currentQuestion":-1,"showAnswer":false,"timerStartTimestamp":1643981927990}
2 changes: 1 addition & 1 deletion match_data/round_data/vcnv_1.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"questions":[{"id":1,"question":"Nguyên liệu đột phá cho Klee là gì?","answer":"Nấm Rơm Gió","type":"HN","value":10,"ifOpen":false},{"id":2,"question":"Bài hát này tên là gì?","answer":"Omokage","type":"HN_S","value":10,"audioFileName":"1.mp3","ifOpen":false},{"id":3,"question":"Game gì đạt danh hiệu Mobile GOTY 2021?","answer":"Genshin Impact","type":"HN","value":10,"ifOpen":false},{"id":4,"question":"What is the study of the movements and relative positions of celestial bodies interpreted as having an influence on human affairs and the natural world?","answer":"Astrology","type":"HN","value":10,"ifOpen":false},{"id":5,"question":"Ngày sinh nhật của Hatsune Miku là gì?","answer":"31/8","type":"HN","value":10,"ifOpen":false},{"id":6,"question":"","answer":"Mona","type":"CNV","value":80,"ifOpen":false,"picFileName":"4.jpg"}],"playerAnswers":[{"answer":"","correct":false},{"answer":"","correct":false},{"answer":"","correct":false},{"answer":"","correct":false}],"showResults":false,"disabledPlayers":[],"CNVPlayers":[]}
{"questions":[{"id":1,"question":"Nguyên liệu đột phá cho Klee là gì?","answer":"Nấm Rơm Gió","type":"HN","value":10,"ifOpen":false},{"id":2,"question":"Bài hát này tên là gì?","answer":"Omokage","type":"HN_S","value":10,"audioFileName":"1.mp3","ifOpen":false},{"id":3,"question":"Game gì đạt danh hiệu Mobile GOTY 2021?","answer":"Genshin Impact","type":"HN","value":10,"ifOpen":false},{"id":4,"question":"What is the study of the movements and relative positions of celestial bodies interpreted as having an influence on human affairs and the natural world?","answer":"Astrology","type":"HN","value":10,"ifOpen":false},{"id":5,"question":"Ngày sinh nhật của Hatsune Miku là gì?","answer":"31/8","type":"HN","value":10,"ifOpen":false},{"id":6,"question":"","answer":"Mona","type":"CNV","value":80,"ifOpen":false,"picFileName":"4.jpg"}],"playerAnswers":[{"answer":"","correct":false},{"answer":"","correct":false},{"answer":"","correct":false},{"answer":"","correct":false}],"showResults":true,"disabledPlayers":[],"CNVPlayers":[]}
5 changes: 2 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ io.on('connection', socket => {
curAuthID = authID;
socketIDs[playerSecrets.indexOf(authID)] = socket.id;
fs.writeFileSync(matchDataPath, JSON.stringify(matchData));
console.log("Player " + authID + " connected at " + socket.id);
console.log("Player " + matchData.players[playerSecrets.indexOf(authID)].name + " connected at " + socket.id);
io.to(adminId).emit('update-match-data', matchData);
callback({
roleId: 0,
Expand All @@ -91,7 +91,7 @@ io.on('connection', socket => {
})
socket.on('disconnect', () =>{
if(socketIDs.includes(socket.id)){
console.log('Disconnect at ' + socket.id);
console.log('Player ' + matchData.players[socketIDs.indexOf(socket.id)].name + ' disconnected at ' + socket.id);
matchData.players[socketIDs.indexOf(socket.id)].isReady = false;
fs.writeFileSync(matchDataPath, JSON.stringify(matchData));
io.emit('update-match-data', matchData);
Expand Down Expand Up @@ -506,7 +506,6 @@ io.on('connection', socket => {
}
});
socket.on('mark-correct-vd', (id, value) => {
console.log(id, value);
matchData.players[id - 1].score += value;
io.emit('update-match-data', matchData);
io.emit('clear-stealing-player');
Expand Down

0 comments on commit e6800c8

Please sign in to comment.