Flight Historian 2.0
Flight Historian

Release Date
  • 31 Jan 2016 (almost 3 years ago)
Repository
Specifications

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:

Logo
www.flighthistorian.com

Along with the new domain, I’ve worked on adding a bit of new functionality to the site.

Premium Economy

Screenshot of Classes page

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.

IATA Codes

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 (M80 for MD-80), both of which you may see when booking flights online.

Screenshot of Airlines page

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.

I’ve added these IATA codes to all airlines (including operators and codeshares), aircraft types, and travel classes.

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.

Screenshot of Excel spreadsheet showing loading times
[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. 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!

Change Log

Front End

Back End