Hardly slept at night, worried very much about everything. Got up and studies a lot before heading to work.
FIrst thing, database down. Lucky I asked, otherwise would be confused.
T came and be all friendly. Probably felt a little bit guilty about not mentoring me very well.
Worked on the Deal->UserNotes thing, trying to filter out a specific note but display everything else. Forgot what I asked H, but he kind of insist that I don’t write too many queries in the template. So I had to figure out how to work with this big long complicated query. Darn it! Now it took so long. Because it is a query that built upon another query, I can’t see the whole SQL very easily. The log file is terrible, and even if it’s not terrible, there is no way to debug such a huge query. For a small feature like this it is really too complicated.
Maybe could try and get a better database tool?!
Or are there ways to just break it down the query, by commenting out part of it. Or, just spend time reading it to get familiar.
Asked H, but he made it even more complicated. He didn’t really answer my question, but attempt to start debugging things himself. It took a whole hour and gets no where. The SQL is really too complicated and it kept crashing the browser to print out the debugging message.
If I’m not in such a survival mode, I probably would start printing it out, understand it, study the SQL, or start commenting it. But I wasn’t. Anyway H figured out that a method was overriden, therefore wasn’t performing the way we expected. So now that the only way I had to do it is to go back to the Model (which the template uses), and implement a method there instead of building the query in the controller. Avoiding the huge query altogether.
Now it works fine. Submit the patch. Praise God. My first goal is achieved.
Now next, showing the exact match from an Ajax list of items. Found the controller really quickly. However, tried to add the exact match by adding condition like = ‘string’ when there is already a string like ‘%string%’. Took me an hour to figure out that I already have the item in the list. Guess I was over tired.
Anyway tried to get the SQL working by getting things on the command line correct. At this point already start panicking, ’cause it already took too long. Worked and reworked the SQL – it is correct, but why didn’t the page return the correct things??
Took another walk, this time even to go outside. Try not to panic, prayed. This time another guy came back and told me about a patch not passing a test. Things can’t be worse…!
During walk, realised that if the SQL is correct, then it must be the ORM thing not building my SQL correctly. Double check, yes the SQL is not correct. The syntax I tried to copy from is wrong. It didn’t put the condition in at all.
Now copied from another function, then it works. VIctory. I prayed for 2 bugs and there they are. Prayers answered.
Spend final hour reading another bug. Looks I am getting good at finding the code, as it took me a few seconds to find the codes to change. Good ending on a friday.