"Those who do not want to imitate anything, produce nothing." - Salvador Dali

Serve and Destroy 1.4.1: Tennis League
Aug2009

Tags: , , , , , | One Comment

Tennis StandingsUpdate: This project has been updated and moved to serveanddestroy.com

Almost every day for the past few months, I’ve been playing tennis with friends at the local public courts. Seeing as how all of us are very competitive and often discussing trends in our play, I decided to put together a small web application so that we could keep track of our wins and losses.

At first, I searched for a pre-made tennis app, written either in PHP, Ruby, or another similar language so that I could customize it. However, it seems as though there are very few coders out there interested in making an open-source, publicly available tennis application. One piece of software that comes very close is Peter’s Sports League Standings. Peter has done a great job making a versatile PHP/mySQL package that likely serves the needs of most users looking to set up a sports league.

Peter’s app seems geared mainly towards baseball,  football, or other team sports that have certain types of outcomes (win, loss, tie) based on certain type of stats (e.g. runs for, runs against). Because of my particular requirements in setting up a tennis standings system, I made a few changes to Peter’s original work, most of which are purely aesthetic. Apart from the design and layout, I also reworked the way in which points are calculated, and the Point totals now take into consideration Matches Won, as well as Games Won. The Set category was left out since it’s implicit in Matches Won or Lost.

Add Score

Because Peter made his original app available to the public, I thought I would do the same, and have provided it here. To get it running, you’ll need your own server space running PHP and mySQL. Just follow these steps based on Peter’s instructions:

  1. Download and unzip Tennis_League_1.4.1.zip to your server. (check out serveanddestroy.com for the updated version)
  2. Open settings.php and set the appropriate username, password, and database name, as well as many other options (how much match wins or game wins are worth, which columns to show, etc.).
  3. Run the SQL commands in standingssql.sql to insert the appropriate database tables.
  4. Access update.php for the administration interface. The default username is “admin” and the default password is “theblog”.
  5. Start adding your wins!

Here’s semi-complete list of changes I made, including the mundane:

  • Points are calculated by adding X points for Match Wins, and X points for Game Wins (X can be changed in settings.php).
  • In order to make it easier for users to add their own scores (if they aren’t tech savvy), I’ve added navigation items to the header, based on what page, conference, or season the user is viewing.
  • Column labels now reflect Matches Played/Won/Lost, as well as Games Won/Lost.
  • Because there is no set number of games to be played, standings are based on Winning Percentage.
  • Simplified the Add Score page, since there were elements which would be unnecessary for recording tennis results.
  • Since I have an iPhone and like to Add Scores on the go, I added a dock icon to the download package, which can be uploaded to your root directory. You’ll see this icon when you add an iPhone bookmark to your league pages.
  • Added some other graphics and css styles.

Edit Standings

I put this together quickly, and as a result the current set of changes are mainly aesthetic. However, I have some ideas for a future roadmap as well; thinking about what else I’d like to change in the application to make it more tennis-focused:

  • Ability to enter the sets played instead of total games won or lost. Not sure if this is necessary but it would make adding scores much more intuitive.
  • Make the Courts column active links to display the location in Google Maps.
  • More detailed profile pages. Since I’ve worked on Facebook applications in the past, some integration here might be possible.
  • More stats: e.g. a function to determine which court has seen the most wins for a given player; a player’s favorite court; which opponent they’ve been most successful against, etc.

Now it’s time to get back onto the courts to rack up some points and build on my win percentage! Hit me back in the comments if you have any questions about how to get things running.


One Comment on “Serve and Destroy 1.4.1: Tennis League”

  1. 1 James said at 12:10 am on July 8th, 2011:

    hey this looks awesome! I’ve messaged you with some questions. Thanks!


Leave a Reply