Skip to content

Commit

Permalink
filter session game
Browse files Browse the repository at this point in the history
  • Loading branch information
duypham1-ntq committed Mar 16, 2023
1 parent 9d05309 commit f078693
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function caculatorScore(socket, dataLive) {
sessionName: _.get(dataLive, 'sessionName', 'datatest'),
});
} else {
await SessionGame.updateData({
await SessionGame.updateData({_id: _.get(sessionGame, '_id')}, {
channel: _.get(dataLive, 'channel'),
userId: _.get(user, '_id'),
score: (_.get(dataLive, 'score', 20)) + _.get(sessionGame, 'score', 20),
Expand Down
4 changes: 2 additions & 2 deletions models/sessionGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ async function add(data) {
.then(async (updated) => updated).catch(async (err) => err);
}

async function updateData(data) {
return await SessionGame.updateOne(data)
async function updateData(filter, data) {
return await SessionGame.updateOne(filter, data)
.then(async (updated) => updated).catch(async (err) => err);
}

Expand Down

0 comments on commit f078693

Please sign in to comment.