script to randomize tournament start times (#6261)

pull/6270/head
Niklas Fiekas 2020-04-01 11:49:38 +02:00
parent d749095aa7
commit 0b9eeac8e6
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
db.tournament2.find({
startsAt: {"$gt": new Date()}
}, {
id: 1,
startsAt: 1
}).forEach(d => {
if (d.startsAt.getSeconds() === 0) {
printjson(d);
d.startsAt.setSeconds(Math.floor(Math.random() * 59 + 1));
db.tournament2.update({_id: d._id}, {
$set: {
startsAt: d.startsAt
}
});
}
});