2/20/13

a feature for nar-nar

goal: I want to add a feature to nar-nar. Sometimes people will review something, make a suggestion to the relevant party, and they'll want to look at it again 48 hours later and make sure that the suggestion was followed through with. So I want a button for that. And I think I also want a "notes" field that will be shown when the task resurfaces, to give the person doing the resurfaced task a note about what they're meant to check.

so.. let's do it. First, let's get the development environment all pointing to nar-nar rather than february-fire — the projects are sisters, and it's easy to work in one while thinking I'm working in the other.. done

next.. let's make sure the project is in a good state — I may have been testing something in it before.. done. Git says that nothing is changed since the last commit.

ok.. now.. let's run it, so I can see where I'll want to make changes, and get a read-eval-print-loop going.. done

ok.. first, currently I have the "reject" button itself take the worker to a page to process the rejection. I think there should be a separate link to that page, since they'll also want to go to it in the case that they will press the soon-to-be "check in 48 hours" button.. done

now let's add the "check in 48 hours" button, just the button itself, it won't do anything yet..

hm.. it's been a while since I've had an html alignment issue:


the yellow "check in 48 hours" button is the same height as the other buttons, but somehow making it have two lines of text moves it up a slight amount..

the behavior is a bit weirder than I thought:


I'm tempted to just make the "check in 48 hours" button a single-line wide button. I'll do that for now.. probably it will stay that way forever.. done

ok, I need a "notes" field too..

hah! I fixed the button issue as a side-effect of trying to get the obo button and notes to line up; namely, I made everything "float:left":


..it's like deciding not to look for my lost keys, and then finding them.

ok.. let's decide what this will look like once accept or reject or "check in 48 hours" is pressed. I had an "undo" button there.. I think I want to keep that, but have it on the far left, and after it I can say "accepted, notes: blah blah"..

done.. ish..

I need to decide how this "check in 48 hours" will actually work. My thought is to make it use the availableToGrabAt thing, since then the query for finding available tasks can be the same. On the other hand, it will be a bit hacky, and I'll need to do things like not clear that when the task is done, since it won't really be done yet..

if I make a separate field, I'll need to add that field to my query for available tasks.. how bag would that be? It will need to be included in the index of course, but the index is cheap, I think.. hm.. I think.. hm.. let's look at the code a bit..

ok, I think I want a "status" field, which can be "ready", "accepted", "rejected", or "check in 48 hours".. actually, we'll make a non-existant status field mean "ready"..

ok, I kindof went into the programming zone of remembering lots of bits of stuff in lots of places and making a fairly large change in one go.. which means.. now I need to test this glob of code..

hm.. when I grab a task, I set the availableToGrabAt to 1 hour from now, but I shouldn't do that for a "check again in 48 hours" task.. unfortunately I update the 1-hour-from-now in an update.. I suppose I could limit the update to only items that don't have their status set to "check again in 48 hours".. perhaps that is best.. though, I probably do want to set their availableToGrabAt time if it's in the past.. hm.. what is a clever way to do this..

ok, after all that, it turns out I'm only ever updating availableToGrabAt to 1 hour from now for tasks for which availableToGrabAt is less than the current time. The reason I thought this was an issue is that when I refresh the page, all the tasks that I had marked as "check again later" were displayed as ready to check again now.. so why is that happening..

(need music: Melissa Ferrick.. one of my favorite artists..)

AHA! I do "availableToGrabAt = 1000 * 60 * 60 * 48" instead of "availableToGrabAt = _.time() + 1000 * 60 * 60 * 48"

ok, now when someone is looking at an item that was marked as "check again later", how will they know it? Perhaps a little message.. done.. hm.. testing that seems like a pain.. well, it's not critical. I think I'll just inspect it later and make sure it happens..

ok.. hm.. I'm tempted to move the admin stuff into the main page. It would be easy, and it would make it easier to explain where the admin interface is located.. but it is not critical.. let's see what is critical..

hm.. they want to see how many items remain to do..

hm.. how do I use "runCommand" in mongojs?.. ahh.. apparently it's like this: db.myCollection.find(...).count(callback)

that's nice. I like that better than the "runCommand" anyway, and apparently it's valid mongodb syntax too..

what else.. oh.. I want to include the name "nar nar" in the tool, since it's cute.. done.

ok, now let's make sure it's all running correctly on heroku..

(more music.. hm.. I'm not super happy with either Spotify's nor last.fm's recommendations.. they have my entire listening history.. alas.. ok, it's Nicki Minaj time.. hm.. it is no longer Nicki Minaj time. let's try Kings of Leon)

ok, it's up.. I think I'll clear some tasks out of the database (they aren't real anyway.. they've been done elsewhere, since this system isn't ready yet)..

ok, good.. now in a couple hours, some tasks should appear.. I think this is done enough for my meeting tomorrow..

No comments:

Post a Comment