2015 Pure Madness Challenge Leaderboard

pure-main

The Challenge

Each year, the Pure Barre fitness studios challenge their members to attend 20 classes in 30 days. The studio with the most members who passed the challenge won a special prize. In previous years, scorecards were kept at each studio and tallied by hand to determine the winner. With almost 200 studios and thousands of participants, this can prove cumbersome, so for 2015, Pure Barre decided to pursue the idea of an online scoreboard.

Developing this scoreboard required nothing less than ingenuity, resourcefulness, and lots of knocking on wood. 25,000 signups and 354,000 classes later, the 2015 Pure Madness Challenge Leaderboard proved to be one of the most rewarding projects I’ve worked on.

Process

The first stage of the project involved building a signup page. I made the signup page with simple HTML and custom PHP that fed into a database. Special form validation was critical to ensure that users entered the correct information and did not enter more than once. With the signup page built, there remained the huge technical challenge of just how the leaderboard would work.

Pure Barre members register for classes online through a system called Mindbody. Tapping into Mindbody’s API was no small task. An API call could return the number of classes each individual took at a given studio, but we could only make so many calls per day. With 200 studios and the leaderboard updating hourly, we needed to find the best method to make as few calls as possible.

I designed the scoreboard update process and the database with efficiency and scalability in mind. I was limited to 5 cron jobs total that could run for no more than 5 minutes each, especially limiting when dealing with an external API. There could be no redundant SQL calls or database tables. Each step in the update process had to be as efficient as possible. The requirements of the leaderboard also proved challenging. Members signed up for a specific studio, but any class they took at any studio would count towards their team. This severely complicated the update process, as each individual member’s class count had to be stored across the entire process.

Errors were another big consideration. API calls could fail, and the scores could be affected. I stored the final scores in a way so that no team’s score would mysteriously drop. The update process was also self-contained rather than cumulative — that is, each update would calculate the scores for the entire month rather than build on the previous updates. This increased update time, but meant that an error in any point in the process would not be fatal to the results. The update process could be manually run in order to calculate accurate final results.

On top of the complex update process, the landing page featured a live twitter feed and a map that displayed the top 10 ranking studios and Instagram posts related to the challenge. My work with social media feeds in the past made this quick to implement, and the map was a fun feature to work on that really helped visualize the leaderboard.

The challenge had almost 25,000 participants by the end, and a smartly designed update process kept it running (mostly) smoothly throughout. The 2015 Pure Madness Challenge leaderboard was a major technical success and scratched my PHP and database design itches on a large-scale application.