Building a time tracking app for a virtual running event

It’s really amazing to look back at our blog that hasn’t been updated in over seven years. Noah and Luke are 8 now, and poor Joseph (5) never even made it on the blog. I guess life got a bit busy and blogs aren’t as cool as they used to be.

Maybe I’ll never write another post, but in order to remember a bit more of life, I might try to write down a few more things.
I’ve continued to pursue trail running and for the past three years, I’ve participated in a virtual running event called Golden Hell Week (GHW). I love the event format:

  • Run five routes (trail runs) in a week
  • Complete them at your convenience
  • Record them on Strava
  • The lowest time wins (bragging rights)

In past years, GHW runners tracked their runs on Strava (a fitness tracking app) and then entered their times in a Google Form. The format didn’t allow runners to see real-time progress and required a lot of manual work to compile results.

While Strava provides leaderboards for segments, they don’t offer any sort of leaderboard for multi-activity or multi-day events, and it gets a bit confusing since activities outside of GHW still appear in the leaderboards. Also, you can’t provide a data range for viewing leaderboard results.

I’m a web engineer professionally and selfishly wanted to build a time-tracking app for GHW that would deliver a much more engaging experience. I initially had ambitious plans that included integrations with Strava. The scope of that quickly spiraled, and ultimately I figured not being locked into Strava might be to our benefit. Who knows, displaying results in a type of leaderboard might actually violate their terms. They have been quick to cut off API access to apps in the past. Remember Relive?

I landed on a fairly simple web app that allows runners to quickly register and add their times. For accountability, runners are still required to provide a link to their activity marked as a “race” on Strava. You can then view leaderboards for each route and once runners have completed all routes, they are pulled into a finisher leaderboard. It’s all a bit of an honor system. If you cheat on a free virtual running event then…

Example GHW Leaderboard

The result was great. In 2021 during GHW, 122 runners logged over 565 runs, with 105 completing all five routes (~29 miles / 5,000+ft vertical gain).

A huge shout out to GHW organizer Quinn for continuing to organize and promote the event after so many years. If you are interested in using the app for your virtual running event, give me a shout.

And thanks to Covid, Lauren and I had a last minute trip to the northeast canceled. I made lemonade by completing a Golden Hell Day (made up by me) by doing all the routes in a single day. It was a painful accomplishment.

tl;dr – The Nerdy Parts

The app is built on Drupal, an open-source content management system. One reason I love Drupal is that it makes things extremely fast to prototype. Building out the data models, handling of user accounts and much of the UI are just using out-of-the-box Drupal. The results are mostly powered by the Views module in Drupal Core.

The custom code that needed to be written was mostly focused on things like calculating pace and ranking results. Doing the project gave me lots of appreciation for Strava engineers and segment leaderboards (check out this post from them). Think about it…each time someone new completes an activity, Strava has to figure out where you fall in the leaderboard and then re-rank everyone following. On my app, I cheated a bit by making sure to always show all results and not use pagination (pagination would have required more work). So essentially I relied on just sorting by the lowest time. Introducing gender rank added some additional complexity. Storing rank data in the database every time an activity is saved is definitely an option and may be required to really allow the app to scale, but I managed to skip that for now.

If anyone has ideas for building an efficient ranking mechanism, please reach out. I’ve considered many options, so I’d love to buy you a beer and discuss.