Archive for the 'Ajax' Category

Bracket Challenge Project

My latest project that I devoped for FanNation / SI.com is the Seth Davis Bracket Challenge for the NCAA Tournament. To date this project has probably been my most complex Ruby on Rails application. I was also really happy with how the interface for picking your bracket turned out. It is all html, css, and javascript based (as opposed to ESPN’s Flash interface for picking teams).

I used a sliding window effect where a div with smaller dimensions set to overflow hidden wrap a div with a greater height and width. After the user saves a region via Ajax, I used the scriptaculous Effect.Move function to animate the screen moving to the next region.

Scrolling SDC Screenshot

Some of the challenges I was faced in this application included clearing out downstream picks if you changed a team in a earlier round that you had advancing farther down the bracket, and displaying pick percentages for each team at each round as you are making picks.

To solve the first issue I set a javacript array that included all the match ids and match position (top or bottom) that were downstream of every match, and when a user clicks a team to select the pick I checked if the opponent in that match was already selected in a position down the bracket and cleared it out.

To dynamically display the pick percentages as you move a team, I printed out a javascript array (actually a JSON object) that listed every team id, and an hash of each percentage ar each round when the page is loaded. Then when the user clickes on a team to advance it, I cloned the innerHTML of the div they were selecting and replaced the innerHTML of the percentage div with the percentage of that team for the next round.

After all the work I put into this, it’s too bad that the interface is only viewable for four days to the users until the game locks before the tournament begins. Hopefully we will make use of the code for next year’s bracket or some other fantasy games we build in the future.

ESPN.com’s NBA Trade Machine

My latest project that I worked on at ESPN was the NBA Trade Machine. This was a fun application to build. Our NBA Engineer Sachin spent a lot of time reading through the NBA collective bargaining agreement, and learning about all the rules about trading players in the NBA. He set up all the formulas and database tables that I used. I built the front end UI for this application. I tried to incorporate some Ajax techniques into this application to make the interface as usable as possible. You can pick up to four teams. After you select a team the application uses Ajax to get the players for that team to display. If a player has a trade restriction that prevents them from currently being traded, the checkbox is set to disabled. Depending on how many teams you have selected I used DHTML to display the team that the player is being sent to after you check a player. If more than two teams are in a trade, a select box is display with a choice of destination teams.

I also used Ajax to display individual player’s trade restrictions. With Ajax it is important to give the user a visual clue that something is happening on the page since the page doesn’t reload. I made a message of “Loading Teams” or “Loading Trade Restrictions” while the Ajax request is completing. One of the most challengin aspects of this application was dealing with the back button since that is an issue with Ajax applications. I ended up puting in as link that passes the trade parameters back to the page and then use JavaScript to fill to make the Ajax calles and fill in the form to the state it was in when the trade was submitted.

Overall the feedback for the application has been pretty positive, and I am still planning to make incremental improvements to the application. As part of this project I also built the administration tools to maintain the player contract and team payroll data. I used a lot of Ajax techniques for those tools as well.




About Brent

I have been a Web Developer since the early '90s working on some of the highest traffic sites on the internet such as MSN.com and ESPN.com. Since 2007 I have been using Ruby on Rails while working for Sports Technologies, a small internet company in Connecticut, developing features for FanNation.com and Fantasy Sports applications for Sports Illustrated.

I am interested in all things related to Social Media, User Experience, and creating great Web Applications.

I am a Cycling enthusiast who raced competitively for many years, and still try to get out and ride as much as I can. I created the site BikeRide.com and have developed some other cycling related sites in the past.

I am a husband, and the father of two girls. I grew up in western Washington, but now live in Connecticut.