← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

Re: Special case for battery-testing

 

On 12/16/2012 09:23 AM, Daniel Ejsing-Duun wrote:
Hi all.

I have been working on an accomplishment lately, which is awarded if the user has written at least three lines on an Ubuntu IRC channel. It goes through the logs on http://irclogs.ubuntu.com/ and returns yes or no.

Since this can be a fairly heavy operation, I just made a small change to a script, making it run only once an hour (logs are updated at the same rate). This also means, though, that the accomplishments-battery can only run at most one of its test cases each time. The second always fails and passes.

I discussed the matter with Matt Fischer and concluded that the best fix right now would be to make a check on the test values to make it skip the hourly check, since this is not really part of the accomplishment.

The question is whether there is currently a better way of handling test cases and perhaps separate them from actual users. Or should there be? Hardcoding specific values does not look very nice, and it might become relevant for future scripts too.

Daniel Ejsing-Duun


One idea I had was a change to the battery file that allowed us to specify a simple command to run prior to running the test. Something like this:

[pre-run]
rm -f ~/.cache/accomplishments/chatonirc

I don't know if this idea is general enough though that it would be useful to anything else besides the chat-on-irc test.

Another simple option would be that the battery could call all the scripts with a "--battery" flag and that scripts that needed it would check for that option and operate differently.

And one more idea I had was that the battery test file simply specify the timestamp, like so:

[timestamp]
chatonirc

The battery would then remove it before running.

I'm also open to just leaving the script as-is, which is the chat-on-irc script that hardcodes the test info and ensures that it will always do a full check regardless as to the timestamp in this case.

Out of all these ideas I like the [timestamp] idea the best and the just leave it like it is idea second best.


--

Matthew (Matt) Fischer
LP: http://launchpad.net/~mfisch
IRC: mfisch



References