3/13/13

hopefully last urgent task before humanscripting..

my goal has been to humanscript a lot of these tasks, but they've been to urgent.. this is hopefully the last one, and it's pretty simple. I just need to increase the delay for warned accounts from 48 hours to 5 days, and add 3 days of time to all the currently warned accounts..

step 1: make warning add 5 days instead of 48 hours.. done
step 2: update existing items in warned queue by adding 3 days (might make warned items that happened very recently have 8 days, but that's probably not worth worrying about).. this seems like a job for mongodb-side javascript..




db.eval(function () {
    var a = db.records.find({'status.warnUntil':{$exists:true}})
    for (var i = 0; i < a.length(); i++) {
        var r = a[i]
        db.records.update({_id:r._id}, {$set:{'status.warnUntil':r.status.warnUntil + (1000 * 60 * 60 * 24 * 3)}})
    }
}, {nolock:true})



...let's test it locally first.. ok, seems to work.. ran on server.. seems to have worked.. super. let's let people know.

oh.. I missed something.. I changed the "warnUntil" value, but that feeds into the availableToGrabAt value, which I need to also change (but only if it hasn't been grabbed)..

db.eval(function () {
    var a = db.records.find({'status.warnUntil':{$exists:true}})
    for (var i = 0; i < a.length(); i++) {
        var r = a[i]
        db.records.update({_id:r._id,availableToGrabAt:(r.status.warnUntil - (1000 * 60 * 60 * 24 * 3))}, {$set:{availableToGrabAt:r.status.warnUntil}})
    }
}, {nolock:true})

..that seems to have repaired it.

ok.. oh, and there's one other thing I need to do.. I added a feature to february-fire that people now want in the clone of february-fire (I'll need to humanscript some merger of these two projects.. though one of them will probably end before that happens anyway..)

phew, ok, done..

No comments:

Post a Comment