more fixing of puzzle vote migration
This commit is contained in:
parent
8bf63b9fb8
commit
085f1f7051
|
@ -1,13 +1,20 @@
|
||||||
var puzzles = db.puzzle;
|
var puzzles = db.puzzle;
|
||||||
|
|
||||||
puzzles.find({}).forEach(function(p) {
|
modified = 0;
|
||||||
|
|
||||||
|
puzzles.find().forEach(function(p) {
|
||||||
puzzles.update({
|
puzzles.update({
|
||||||
_id: p._id
|
_id: p._id
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
vote: {
|
vote: {
|
||||||
enabled: (p.vote.up * 3 > p.vote.down) || (p.vote.up + p.vote.down < 50)
|
enabled: (p.vote.up * 3 > p.vote.down) || (p.vote.up + p.vote.down < 50),
|
||||||
|
up: p.vote.up,
|
||||||
|
down: p.vote.down
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
modified += 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
print(modified);
|
Loading…
Reference in a new issue