work notes

ok, I'm still trying to pay people in the february-fire system using the oDesk API. I want to create a script that does it that I will run as a heroku cron job.

The plan for the script is to iterate through all the tasks, and construct stats for each worker saying how much money each worker deserves, and then we'll pay each worker the difference between how much they deserve, and how much we've already paid them, and then increment a counter of how much we've already paid them (and if the program has an error between paying and updating the counter, then we'll end up paying them again, but hopefully that won't happen often, and will only be for small amounts). I feel like a "perfect" solution would involve querying oDesk to see how much has been paid, but in theory, a person could have been given a bonus manually for some reason, and my system wouldn't realize that it hadn't given them that money, so it would need to do more than just query how much has been paid for the engagement.. somehow it would need a breakdown of the transactions themselves..

hm.. there are some old answers that were reviewed by the same person who wrote them, before the logic was in place to prevent that. I'll probably want to re-open those questions for review, but I also want to make sure the reviewers are still paid (since it was my fault and not their fault that they were able to review their answer, and presumably they did spend time reviewing it, even though they probably ended up deciding it was good). Since I'll be recalculating everything from ground truth in the cron job, I need to trick that calculation into still thinking that these reviewers did a reviewing task, even though there is no record of it.. perhaps I'll make a record of it in the "history" attribute, which currently just has records of rejected jobs — I'll make a special entry for an "accepted" job.

Ok, I've written all the code. Now to test it. But I don't want to hurt anything while testing it.. I think I'll copy the database from heroku to my local machine, and test it here.. how do we get a dump of the database again..

I see a lot of stuff about mongodb 2.2.. I want to make sure that's the version I'm using both locally and in MongoHQ. Let's check.. locally I have.. 2.2.3, and on MongoHQ they have.. also 2.2.3. Great.

ok, now to download the database using mongodump..
something like this.. I need to adjust it for my needs..
mongodump -h flame.mongohq.com:27053 -d YOUR_HEROKU_APP_NAME -u heroku -p HEROKU_PASSWORD -o db/backups/

ok, got it in my _dumps directory. Now to "restore" it to my local mongod..

so, it seems to be working, locally.. though I haven't actually called the payments API.. I'm not sure how to test that function..

I also included spitting out "PAYMENT ERROR!" to the logs if there is a payment error, and I think I can make the Logwhatever plugin email me if that ever happens..

..hm.. what to do to test this sucker for real.. it will involve doing "heroku run" I think.. maybe I can make it artificially fail after the first payment, and make sure that that payment happened.. that will also let me test the error in Logwhatever..

ok, before continuing payment stuff, let's do a few things:
1. eat
2. put on music
3. deal with people having reviewed their own work, so I don't have special cases for that in the payment code
4. I'd also like to shower and get ice cream.. ice cream for after payments are done I suppose, but I'll need to buy it before midnight..

ok, let's shower, and then buy ice cream, and get Subway..

No comments:

Post a Comment