Skip to content

Commit

Permalink
fix swiss cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 23, 2020
1 parent 5caee38 commit 1c0c279
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/mongodb/swiss-fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ db.swiss.find({nbOngoing:{$ne:0}}).forEach(s => {
const count = db.swiss_pairing.count({s:s._id,t:true});
if (count != s.nbOngoing) {
print(`nbOngoing ${s._id} ${s.name} ${s.nbOngoing} -> ${count}`);
db.swiss.update({_id:s._id},{$set:{
nbOngoing:NumberInt(count),
nextRoundAt: new Date(Date.now() + 1000 * 30)
}});
const set = {
nbOngoing:NumberInt(count)
};
if (!s.finishedAt) set.nextRoundAt = new Date(Date.now() + 1000 * 30);
db.swiss.update({_id:s._id},{$set:set});
}
});

0 comments on commit 1c0c279

Please sign in to comment.