It’s been over three years since I began working on my flight log. In that time, it’s gone from an interesting side feature of my Portfolio to a major project large enough to stand on its own. For the past month, I’ve been spending my free time working on spinning it off into its own site. Now announcing:
Along with the new domain, I’ve worked on adding a bit of new functionality to the site.
I started the flight log with the capability for three classes: first, business, and economy. (I’ve then somehow managed to never fly business class.) Over the last few years, many airlines have been adding a class of service that’s a little better than a standard coach class seat, but not quite to the level of a business class seat. At the very least, premium economy seats offer a few inches more legroom than a standard coach seat, and occupy a favorable part of the plane (often between the economy bulkhead and the over-wing exit rows). Many airlines are now charging for these seats or reserving them for passengers with frequent flyer status.
The experience is different enough from standard economy, and present on enough airlines, that I feel comfortable tracking premium economy as its own class.
Fortunately, I’ve been scanning and saving my old boarding passes for the past few years, so I was able to determine which of my recent economy flights were actually premium economy.
You may be familiar with the three-letter airport code you see printed on your boarding passes (for example, LAX for Los Angeles). This three-character code is assigned by the International Air Transport Association (IATA).
Airports aren’t the only thing that the IATA has codes for; they also have two-character codes for airlines (DL for Delta) and three character codes for aircraft types (M83 for MD-83), both of which you may see when booking flights online.
The IATA technically has one-letter codes for travel classes, but most airlines use their own fare codes instead. However, many travelers still informally use these IATA codes (F for first, J for business, Y for economy) to refer to the class they’re flying.
Faster Loading Speeds
My old flight log often took a long time to load. For a while, I’d been assuming that I was simply hosting my site on a slow webserver.
I realized there was more of a problem when doing all these updates required me to spend a lot of time with the site running on my local computer. Since I was the only user, it shouldn’t have been slow – yet it was.
Looking at my local server logs, I noticed that some pages were taking nearly seven seconds to render, and had thousands of database queries.
[Technical explanation – feel free to skip this paragraph.] It turned out that in some code that I used in a lot of places, I was inadvertently triggering a few database queries (due to ActiveRecord associations that I’d forgotten were actually part of another table) within each iteration of a for loop – in other words, N+1 query issues . By explicitly setting up my own monolithic SQL query with the joins, I was able in many cases to do one big query rather than thousands of tiny queries. Additionally, I’d broken some of my Ruby on Rails code into too many partials, which was driving up the view rendering time substantially. Combining a few of the partials into one helped out quite a bit.
Essentially, by optimizing some of my code, I was able to make most of the Flight Historian’s pages load much faster than they did in the old Flight Log. In particular, the home page (“root”), which is the page most people will see first, went from loading in 3.74 seconds to loading in 0.20 seconds – about 18 times faster!
- Premium economy to list of travel classes.
- IATA codes to airlines, aircraft families, and travel classes.
- Aircraft illustrations to aircraft family pages.
- Aircraft name to Show Flight view.
- Tables of operators to Show Aircraft Family, Show Airport, Show Airline, Show Tail Number, Show Route, and Show Travel Class views.
- Region selectors to many more maps.
- Country flags to tail numbers.
- Boarding pass data attribute to
- Date sanity checking to warn if local departure date and UTC departure datetime are too far apart.
- Separated Flight Log from being part of Portfolio into its own site.
- Renamed Flight Log to Flight Historian.
- Replaced favicon.
- Upgraded Ruby from 1.8 to 2.2.
- Upgraded Rails from 3.2 to 4.2.
- Converted database from MySQL to PostgreSQL.
- Converted stylesheets to SCSS.
- Optimized database queries and page rendering to make pages load faster.
- Airlines are now their own
Airlinemodel rather than an attribute of
- Aircraft families are now their own
AircraftFamilymodel rather than an attribute of
- Moved list of flights to the end of Show views, and provided a link to the list of flights section under the flight map for each of these views.
- Rewrote Great Circle Mapper map generating functions to be more consistent.
- All maps now use the same color scheme.
- Minor typo fixes.