Skip to content

Commit

Permalink
fix bug emit
Browse files Browse the repository at this point in the history
  • Loading branch information
phamanhduy committed May 20, 2023
1 parent 6aca64a commit a9e922d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ async function addScore({username, name, avatar}, {channel, sessionName, score},
}
dataSess['followed'] = true;
}
await SessionGame.updateData({_id: _.get(sessionGame, '_id'), sessionName}, dataSess);

const winner = await SessionGame.getLimitWinner({
sessionName,
}, 15);
socket.emit(`${channel}-ranking`, {
ranking: winner,
sessionWinner: null,
await SessionGame.updateData({_id: _.get(sessionGame, '_id'), sessionName}, dataSess, async (data) => {
console.log({data})
const winner = await SessionGame.getLimitWinner({
sessionName,
}, 15);
socket.emit(`${channel}-ranking`, {
ranking: winner,
sessionWinner: null,
});
});
}
}
Expand Down

0 comments on commit a9e922d

Please sign in to comment.