Thursday, February 14, 2019

Logbook Tweaking!

So some of you might have noticed that I took AQ down for about 15 minutes. Yes, it's the latest and greatest of updates! Actually, this update is pretty minor, but it was a lot easier to do the update while the site was down.

This update mostly involved the logbooks. The main goal this time around was to battle slow queries. There are a growing number of people with well over 10,000 finds to their names and AQ was struggling to show pages of those logbooks. It would literally take the database over 10 seconds to create the page showing the finds. If you clicked through to see page 2 of the results, it would take another 10+ seconds to generate. A website that "hangs" for over 10 seconds at a time is problematic! It's probably not a problem you noticed often because most people don't have enough finds to cause such issues and it's not very often that people look at logbooks for people with that many finds--maybe AQ would record half-dozen such slow queries in a day. But... it's a problem that grows increasingly worse as the number of people with large number of finds grow, and I was determined to fix it. As a whole, I prefer the pages on AQ to take less than 1 second to generate. (By comparison, most queries take about 1/1000th of a second to run, and even the slower ones rarely take more than half a second.)

So.... AQ's logbook now includes a dropdown list with years that you've found boxes and will show a list of all of the finds from that year. It runs a lot faster this way! It also won't paginate the finds. Whether there is 1 find or 5000 finds, they'll all be displayed. Which--if the number of finds is in the thousands is a bit unwieldy, but paginated finds were unwieldy already and good luck trying to figure out which page had a particular box you were looking for. At least with everything on one page, you can search the page with your browser to find a particular listing.

I figure that most of the time, people are interested in recent listings so the default setting isn't to show a specific year at all. Instead, it'll display the most recent 500 matches. Which means if you have less than 500 finds, all of your finds will be on that one page. If you have more than 500 finds, only the first 500 that match your sort will be displayed. But if you know the find was from last year (for instance), it might be easier to view the smallest list from last year.

The update was mostly meant to target the finds since that's where people have (literally) tens of thousands of entries which was causing the slow queries, but the same code runs the pages showing your plants, adoptions, attempts, carves, donations, etc. so the year option now shows up for all of them and the same rules applies. The logbook pages for exchanges, tracker signups, event signups, photo albums and.... why does it seem like I'm forgetting one? Anyhow, those non-box searches use different code and therefore don't have the year filtering option.

Make sense?

If you don't see the rows numbered, do a browser refresh. I updated the CSS and if your browser is using a cached CSS page, you won't see the numbers. Or ignore it and probably within a few days they'll eventually show up on their own when your browser refreshes the CSS.

Happy trails!

-- Ryan, keeping AQ running fast since 2004