4 ms·
EDIT: I was understandably being downvoted for saying that the code could be more readable. On reflection, the sql is good, and it's the Perl-ness that I had a
by aidos 5y ago
EDIT: I was understandably being downvoted for saying that the code could be more readable. On reflection, the sql is good, and it's the Perl-ness that I had a bit of a reaction to.
I'll leave my questions here in case people would like some food for thought anyway.
- what's with the mixture of styles (q{sql}, sql with '?', sql with '$1', sql with '\$1' etc)?
- what's the use case for a right join, when left joining is the norm?
- in the $stats query, inactive_workers isn't actually inactive_workers and instead it's patched based on active workers afterwards. For me, the jumping of inconsistent column selections on each line makes it hard to see that. (If someone just copied the sql into psql to run it, it would be wrong, but not obviously)
- Maybe it's not fair, because I have sqlalchemy to improve readability, but this whole thing where the variables aren't obvious in a blob of sql could definitely be easier to read
- mst 5y agoI see where you're coming from finding the perlish string formatting weird, I guess I barely even notice that part and was assuming incorrectly it would be everything else about the perl that would bother people. So I guess that while you perhaps did have suboptimal judgement in your initial reply you very much weren't alone and I should remember to be more careful about that going forwards.
- gurjeet 5y agoSorry to be that guy, but your comment is pointless, so I had to downvote it. While the beauty is in the eye of beholder, and you may be correct, or have high standards, praise coming from the likes of @mst should be taken seriously. People may have seen code that can stand in for sh?t, so it makes them appreciate simple niceties like good formatting, good and concise logic, etc. BTW, I have to agree with @mst on this one; even though perl is very low on my scale of pleasantness for languages, the SQL in that code is beautifully written.
- aidos 5y agoI think your comment here is reasonable and you were unfairly downvoted by others missing the deleted context in my original comment. I’ve upvoted you partly on those grounds, and partly to get you back to 1337 :)
- gurjeet 5y agoHah. I was bummed when I lost my leet score, especially because it was lost towards the wrong direction. Thank you!
- mmcgaha 5y agoI agree with you on the right/left join issue. I don't think I have ever used a right join. But then again I don't use greater-than signs either so maybe it is me.