2009/9/17 Loui Chang <louipc.ist@gmail.com>:
On Thu 17 Sep 2009 12:31 +0800, Gergely Imreh wrote:
Also, I'm a bit puzzled by the objection to a single line of $row['Orphan'] = ($row['MaintainerUID'] == "0" ? "1" : "0"); which was countered with a suggestion of a full database re-query.
Would THAT really take that much shorter? Have to do some checks in my test aur install to wrap my head around it. Would have thought that AUR has a lot of other inefficiencies that can be improved (pretty sure that my PKGBUILD parsing routines are no exceptions), before we worry about a single "if".
My concern is that nowadays the JSON interface is being accessed quite a lot. That can only grow as more users access the site and more features are added. It's best to be prudent and get the best value out of the code that we can. Those instructions don't add any value in my opinion. I see it as the equivalent of adding:
# This is a comment echo "";
I agree with the best value of code completely. Didn't know the usage statistics, and I didn't really use the json interface (or used it until now), only when there were things to fix. I start to like it, though. :) The example of Zero Added Value: come on, that's not quite the same. An output variable that you prefer with another name but maybe some would like the way I sent it, compared with an empty instruction? Opinions disagree, and I know very well, that the "patches are welcome" != "your patch will be applied". The discussion is very helpful and I certaily learn from it. Also, will try not to turn these things into bikeshed painting...
Having said all this, I can see the point of returning the username / "orphan" (or username / ""?) instead of Orphan logical variable. I
There's no possibility of someone having "" as a username, so that's best. No extra processing either.
Sounds good.
wouldn't have chosen it myself originally because of the extra database hit, but now it seems to be more in line with the behaviour of the web interface.
Sorry. I was just showing how to grab the Username in a query. You would build that into the existing queries, so there's only one query per rpc request.
My fault, should have read it more carefully. And my SQL needs to be improved anyway, so my original objection had no basis.
Loui, do you want to write that changes, or should I send an updated patch? I don't mind either way, glad to get the job done. :)
You're certainly welcome to give it a shot. If you're finding it difficult, I can write the patch. I'm a bit lazy though. :P
Sure thing. I know what it should do, so shouldn't be to bad. Be back with some code later. Cheers, Greg