Database issue on 6/12-6/13

It’s a little after 1am ET on Saturday, June 13th, and I’m about to get ottoneu back up after messing up the database about 1.5 hours ago.

I’m working on getting ottoneu Fantasy Football ready for this fall, and in setting up some testing this evening I accidentally ran some operations meant for the football database on the baseball database. The end result is that all lineup changes made on Friday, June 12th have been irrecoverably lost.

I apologize, of course. It is unacceptable for a fantasy game to lose even a tiny bit of integrity in scoring.

The bright side, if you can call it that, is two-fold: 1) whoever you had in your lineup for Thursday will get stats on Friday, so teams will not get 0s across the board, and 2) this affects everyone equally.

Again, I apologize. I am working very hard on making ottoneu a world-class fantasy experience, and tonight was a slight misstep. I will do everything in my power to prevent mistakes like this from occurring in the future. As always, please reach out to me via email if you have any concerns or would like to have a longer conversation.

UPDATE: Just realized that if you started an auction on 6/12, it will probably need to be started again. Trades may also need to be re-accepted too – if this is causing a significant problem, please let me know. I’m hoping that because it was only one day, it shouldn’t have too great an impact.

UPDATE 2: I have made the following measures to prevent these events from occurring in the future: 1) database backups every other hour instead of once a day, 2) a change to how I connect to the ottoneu database

UPDATE 3: I’ve taken more steps to ensure this kind of mistake won’t happen again. I’m looking into building a tool that would allow commissioners to retroactively change lineups, though the jury is still out on if this is a good idea or a reasonable response to losing one day’s worth of lineup changes in 3+ seasons. Comments, Slack, and email remain the best ways to reach out!

Week 2: Baseball Scores and Football Drafts

Last week was all about creating and joining football leagues. This week was wider in scope and full of interesting changes.

On the ottoneu Fantasy Baseball side, I pestered FanGraphs into giving me live scores of MLB games. By pester, I mean I asked nicely once. Integrating this data was not hard, and now live game scores are on the Live and Lineups pages. Doubleheaders are presented better on both of these pages as well. Now you can keep tabs on both your fantasy players and your favorite team from one page!

A lot of progress was made on ottoneu Fantasy Football this past week. Leagues can be created and joined and (most importantly to me!) paid for, which are the majority of the milestones ahead of release. Today I started working on another major milestone: the auction draft. The interface is going to look a lot like the ottoneu Fantasy Baseball system one for now. However, player search is much faster and drafts should generally go much quicker, since there will only be 20 roster spots to fill instead of 40.

I also experimented with Flex and Superflex on the new lineup pages. The good news is that they both now work properly. The even better news is that proof-of-concept 1 Flex, 2 Flex, and Flex+Superflex roster arrangements all work properly, which means that ottoneu Fantasy Football will launch with some form of lineup customizability. Between this and the scoring options, ottoneu Fantasy Football’s week to week experience should be varied and interesting for all kinds of fantasy football owners.

This upcoming week is going to be all about the auction draft. I’m hoping it will go quickly by utilizing the best parts of the ottoneu Fantasy Baseball auction draft system. There could be an alpha test as early as mid-June on some of these features, so please let me know in the comments if you are interested!

Football Week 1 (in which leagues can be created but not joined)

My first full week working entirely on ottoneu Fantasy Football just wrapped up, and it seems like a good idea to share the progress made over the past few days.

Screenshot 2015-05-25 10.38.47

I mostly committed code to football, but there was some effort on baseball as well. The biggest baseball change made was that owners can no longer see who started an auction until after the auction is completed. This will force owners to bid based on the quality of player rather than against the team that started bidding. This was a small change, but an important one to some of the more competitive leagues. I also made a small fix to how math is calculated in the trade wizard and changed who “Trade Withdrawn” emails are sent to based on bugs reported in Slack. Did I mention you should join the ottoneu Community Slack?

The football week was spent working on league creation – a pretty natural place to start. As of a few minutes ago, owners can create leagues at all payment tiers, $20 to $500. However, no one else can join these leagues! That will be the milestone for the upcoming week. Once people can create and join leagues, the next major milestone will be porting the auction draft from baseball to football, with a few small improvements of course.

This first week has been more productive than I expected, and if I can keep this up I feel pretty confident about an early July launch for ottoneu Fantasy Football.

ottoneu Fantasy Football: Coming July 2015

ottoneu Fantasy Football will be launching in July 2015. Teams will start at $20/season, there will be prize leagues, and I have chosen to leave my day job to devote all my attention to launching ahead of the 2015 football season.

ottoneu Fantasy Football will be unlike other fantasy football games and somewhat similar to ottoneu Fantasy Baseball. I wrote a quick post about this last November, but I also need to learn more from you! What are you interested in getting from a fantasy football game that you do not get today? Is ottoneu about advanced stats, prospects, team-building, or a combination? As the football game begins to come together, your input and feedback will be vital to its success.

The next few months are going to be a sprint to make sure the core football systems are in place and ready to go for the 2015-16 NFL season. I’m available via the normal channels, and I would highly recommend joining the ottoneu Slack community to participate in the ongoing conversations about both baseball and football.

ottoneu On The Go

TL;DR – ottoneu is now mostly responsive and works much better on mobile devices, so visit on your mobile phone and let me know what you think!

In my last post, I dug into some of the most common ottoneu feature requests and built as much as I could during a little break from my day job over the holidays. When I first requested feature ideas on Facebook, and really every time I’ve ever asked the community for their wishlist, there is one common request that I wasn’t able to address over the holidays – a mobile app.

There are a couple reasons for this:

  1. Building native apps for Android and iPhone would distract me from continuing to improve the core ottoneu platform
  2. Maintaining (at least) two native apps while also maintaining the platform is a heavy ask for a single person who is, for now, running ottoneu as a side project.
  3. Native apps are a less flexible approach to mobile device support than making the existing site work well on mobile devices

With regards to #3 above, apps mean unique development for each mobile platform, a lack of support for future devices, and less than instantaneous addition of new website features. A mobile-friendly web layout addresses all of these issues. In reality, all these issues I’ve enumerated boil down to one thing – I’d rather try to build one thing (the core website) well, instead of three things (website, iOS app, Andoird app) poorly.

With all this in mind, I started digging into a mobile-specific layout for ottoneu this weekend, and I made a lot more progress than I expected! I am continuing to tweak little things here and there, but you can see it in action now. You will need to clear your browser’s cache to see the latest changes, and if you don’t take this step the site will look broken. Please check it out and let me know if you have any questions, concerns, or notice potential for improvements.

A Very ottoneu Holiday

I’m always looking for ways to improve ottoneu, and in the spirit of giving, I posted a quick question on Facebook. (give back and like ottoneu on Facebook!) The feedback was tremendous, and I’ve whittled it down to a few achievable, worthwhile features and fixes to hack through tonight and tomorrow:

  1. Counter-offers on trades – You just received a big trade offer and the deadline is looming. You don’t want to accept this particular offer, but at least it is a starting point in finally nabbing that superstar that will push you over the hump. If you’re grinch-like and press the Reject button, you have to build a counter-offer completely from scratch. Once I’ve built out this option, there will be a nice “Counter-Offer” button next to “Accept” and “Reject” that will allow you to keep chasing that elusive blockbuster trade.
  2. Trade email should include reason trade was rejected – Ok, so your trade was rejected – why? Surfacing this information more directly via email will save you a few clicks.
  3. Sortable headers for watchlists – To be honest, watchlists are a feature I had never considered when I launched ottoneu, and I still don’t use them to their full potential. But, you asked and you shall receive.
  4. Watchlist notes – You can thank Michael J. Shank for this request: “Notes for each player on the Watchlist so I can remember why I added them.” Because, sometimes, we forget.
  5. League History (historical how teams finished) – What’s the point of a dynasty league if you can’t brag about winning 2 years ago? You can view old standings now, but I’ll make it more accessible.
  6. Some way of designating who won the most recent season – We are now getting into some reach goals, but with a little focus and determination I can possibly make this happen. (possibly make this happen..) I don’t have anything in mind for this just yet, but I know that past champs will have their day.
  7. Link to average value page – Hey, did you know this page exists? Wouldn’t it be great for it to be at your fingertips when you are about to bid on a player or prepping for your auction draft? Yeah.
  8. Link twitter/facebook to your account and have that show up on team pages you own – Ah ottoneu, bringing people together over the shared love of stats, baseball, and fantasy sports. Or something. Maybe a begrudging respect. Either way, you’ll have the opportunity to connect outside the world of ottoneu.

I’ll get started on these specific goals soon, and I’ll keep you all updated as they get checked off my list.

Have a very ottoneu holiday and new year, and thank you so much for playing! (AND, I didn’t forget the biggest gift of all: FOOTBALL IS STILL ON ITS WAY)

UPDATE 12/23 11:46pm ET: Watchlists have been updated! Sortable headers and notes have been added, check ’em out.
UPDATE 12/24 6:04pm ET: Counter-offer button up, and emails now show a reason a trade was rejected, if any is given. 1-4 are done, and 5 & 6 are next up.
UPDATE 12/24 6:22pm ET: Past standings are now easily accessible on the standings page. Go forth and brag!
UPDATE 12/24 11:04pm ET: The team page of the most recent league winner now says they won the league last year. More bragging!
UPDATE 12/25 6:18pm ET: A new feature, the record book, has just been rolled out. Go to the Tools tab (where Average Values now lives, permanently) to see it.

ottoneu Fantasy Football Will Be Different

Let’s talk for a second about the big announcement from last week. ottoneu Fantasy Football is coming next summer! How will it be different than standard fantasy football?

  1. Auctions: Like ottoneu Fantasy Baseball, the football game will be based around assigning dollar valuations to players. Players can only be added via auction, either 48-hour blind or during the live auction draft, or via waivers within 24 hours of a player being cut. The roster dynamics will be very similar to ottoneu Fantasy Baseball, basically. It’s worked well for baseball, and there is no reason it will not work for football
  2. Depth: The test league is launching with 20-man rosters and a $400 cap. The lineups are standard (QB, 2RB, 3WR, 1TE, 1K), so this leaves a lot of bench spots, and a lot of opportunity for both stashing for the future or depth for winning now.
  3. College Players: College is the football equivalent of baseball’s minor leagues. Stashing elite college talent such as Jameis Winston, Marcus Mariota, and Todd Gurley in the hopes they can become elite NFL talent is an exciting difference-maker for ottoneu Fantasy Football, and will allow team owners to use their depth and their scouting skills to build for both today and the future.

What other things would you like to see out of ottoneu Fantasy Football? Which of these features excites you the most? What other questions do you have? Comments are open, so ask away!

ottoneu Fantasy Football

ottoneu Fantasy Football will be launching in July 2015.

I will give you a moment to collect yourself.

I am very excited to bring ottoneu to football! Auctions, deep rosters, building for both now and the future – fantasy football needs a more realistic game, and ottoneu Fantasy Football will be that game.

This is where you come in: I need your help. There are still a few weeks left in this NFL season, and ottoneu Fantasy Football is ready to play today. I am putting together a short-season league to play-test the site and the game and to directly give me feedback about the game rules and user experience. There are a few people already signed up, such as the founder of FanGraphs David Appelman, ottoneu Fantasy Baseball co-creator Chad Young, and even me! I’m looking for a fantasy diehard to round out this league, give me feedback, and help shape ottoneu Fantasy Football before its full release next summer. There might even be room for a second…

To clinch your test-player spot: like ottoneu on Facebook and show me/tell me why you’d make a great participant. A decision will be made by Tuesday, November 11, so hurry up and Like and comment!

I hope that you are all as pumped for ottoneu Fantasy Football as I am! Please reach out to me if you have any questions, either on Facebook, here in the comment section, or via email!

Lineup records, innings caps, and scaling

I haven’t rolled out any major new changes to the ottoneu platform yet this year, because I am working on a doozy. If you go back to my post about the 2014 plan, you’ll see the first bullet point is a new stats backend. The original goal was to get this done pre-season, but this problem ended up being more complex than I expected. In this post, I am going to walk through the infrastructure as it exists today, the proposed changes, and why it ended up taking a lot longer than expected.

Today

Currently, the system is fairly simplistic. Every 5 minutes, a script runs that checks if games have started and thus if players should be ‘locked in’ to their fantasy team’s lineup. This creates a record in a table, and this table is now the script by how stats are compiled – it contains every team’s locked-in lineup for every day in the season. As long as nothing happens to this table, stats can be re-run at any time for any reason.

Every 20 minutes, a script is run against this table to update stats for the day. This script writes a record in a stats table for every single lineup record.

Let me write that again in a bit bigger font:

This script writes a record in a stats table for every single lineup record.

This is both completely unscalable and also required if a game is going to have a hard innings cap. Consider the following scenario: it is the last day of the baseball season, and in my league I am starting Clayton Kershaw and in your league you are starting Clayton Kershaw. However, I have 1497 IP this year, and you have 1490. Kershaw spins a complete game masterpiece, and I get the first 3 innings of it because I run directly into my 1500IP cap, and you get all 9 innings. This necessitates having two records for the two Clayton Kershaws we have created – one who pitched 3 innings and then the team couldn’t take anymore innings, and the other that pitched 9. (Aside: if only it was this easy to clone Clayton Kershaw)

The solution: moving from a hard inning cap to a soft inning cap.

About innings caps

Inning caps simply define how many innings your fantasy team can collectively throw in a season. Similar to game limits for positional players, the idea is to keep all the teams in a league around the same number of innings, so that teams are not incentivized to start every single pitcher they can in order to win counting stats.

There are two ways of implementing an innings cap: hard and soft. Every major site uses soft inning caps, meaning on the day a team goes over the cap, that team will get all the innings pitched on that day but none going forward. For example, if there is a 1500 IP cap and your fantasy team has thrown 1499 innings in the season, you can start 5 starting pitchers and 5 relievers and get all their innings on that day, but once you are over the 1500 IP cap you will no longer get credit for any innings your team throws going forward. A hard cap is more restrictive – as soon as your team hits the 1500 IP cap, that is it, no more innings for you. The hard cap was originally implemented to move fantasy owners away from ‘streaming’ pitchers on the last day of the season, or playing as many pitchers as possible in order to get as many counting stats as possible. Streaming felt like gaming the system, and ottoneu doesn’t care much for gaming the system.

However, it became clear that there are existing incentives in ottoneu for not streaming: keepers and cap penalties. Cutting players in order to pick up potential starters late in the season is expensive due to cap penalties, and towards the end of the season a lot of players on an ottoneu team are either keepable or expensive but productive players that simply should not be cut. If an owner chooses to cut productive and keepable players in order to stream pitchers at the end of the season, they probably have a good reason and the system of the game should accept that.

In leagues without keepers and without cap penalties, streaming remains game-y, which is all the more reason to play ottoneu.

Tomorrow (or, soon…)

The switch to soft caps will happen over the all-star break, because there are significant database operations required to make this switch. However, I can advocate for this change with two numbers:

6,613,323

As of writing this post, this is how many records are in the stats_batting table.

159,935

After making this change, this is how many records are left in the stats_batting table. That’s a lot fewer records.

How does this affect you? Speed. After this change, getting updated stats will become significantly faster, meaning your standings pages will be updated faster. It will also allow ottoneu to grow its userbase considerably, which would not be possible without this change.

What’s next?

Once I get this change ready to deploy, I am going to turn entirely to the lineup page experience. I believe it can be better, and I’d love your thoughts on what a great lineup page for ottoneu looks like. Or, let me know what you think could be a huge improvement to ottoneu – I’m always open to new ideas!

Please let me know your feedback on these changes and if posts like this are interesting!

Auction Drafts, ottoneu, and you

Tonight, two leagues had long delays with their auction drafts. I want to write about what happened, the full context around the circumstances, and how it will be fixed going forward. I think it is very important to be transparent about these issues to show how ottoneu is going to improve to address these concerns.

At 3:07pm ET, I received this tweet:

I am currently in Copenhagen, Denmark on vacation from my day job, and my data plan is wonky to say the least. I received tweets regarding this issue for the next hour:

I also received a number of emails during this time period.

I happened to see this last tweet when opening my Twitter client on my phone. Up to this point in the trip, I received push notifications upon new tweets, but this time I didn’t see anything until I happened to open my phone’s client. As soon as I saw these tweets, I rushed back to the apartment I am staying in and spent about 2 minutes debugging the issue and resolving it.

There are a number of questions about this scenario:

  1. Why was the issue not acknowledged earlier?
  2. How was it fixed so quickly when it was open for so long?
  3. Why are there so many issues with auction drafts on ottoneu?

I will address each of these issues in order. Of course, if you have other concerns, I’m more than happy to address them over email or in the comments.

1. Why was the issue not acknowledged earlier?

I am in Denmark right now, for my first vacation since July of last year. Unlike last July or the previous vacation in November 2012, my laptop was not with me the entire trip and I did not put someone else in charge of any issues in my absence. This is also my first trip during the peak ottoneu months, which are February and March, when all the auction drafts occur. Finally, while I expected Twitter push notifications to my phone, I did not receive any this evening.

Solution:

While ottoneu does not make very much money at all, what little I do make this year will go towards a small laptop that I can keep on my person throughout February and March. I will also be more conscientious of vacations during this time, and much closer to this or some computer during this time, until ottoneu makes enough money to warrant a second employee. There is no excuse for this not being addressed faster during such a sensitive time.

2. How was it fixed so quickly when it was open for so long?

Plenty of ottoneu issues are actually quite simple, and only come up when some code I hastily write is pushed into production. In this case, I did a big rewrite of the auction draft in the offseason to try and improve performance. Part of this was to introduce redis to the ottoneu technology stack. Redis comes highly recommended from the aforementioned day job, and I have some experience with it but I made a couple of fairly simple mistakes. These cropped up quickly when faced with production load, and I was able to sort them out and resolve them quickly.

Solution:

See the above – faster response time will almost always mean a faster resolution. A longer-term outlook has a better test environment and more robust testing, but honestly that is a luxury right now.

3. Why are there so many issues with auction drafts on ottoneu?

While no one has straight-up asked me this question, this is a question I ask myself often. There are basically two competing interests:

1) auctions are hard to schedule and when they are scheduled, everyone wants to run their auction.
2) auctions are computationally difficult to keep real-time, and they are also very sensitive to errors, so there should be 100% confidence in live auction drafts when they are run.

There are two solutions that I am capable of: the first is rewriting large portions of the auction draft code to use more redis and less database. Database bad, cache good. The second is to invest in more servers. I plan on doing the former extensively, as talking to a few colleagues indicates that this will increase capacity considerably. I’ve already done this a bit, and I hope to do this more.

I’ve already increased the number of auction drafts that can run at a single time by 50% over last year. I’m hoping to pop it up to a full 100% and then start exploring more server capacity. So this is a “stay-tuned”, but is also a catch-22, because like I said earlier, ottoneu really doesn’t make much money at all (it was a net-loss the last two years even without any full-time employees). So until ottoneu truly has enough users to afford more server capacity, more efficient code is the best way forward. Like I said, I will continue to work towards this end to make this a reality.

That is the full situation around the issue tonight and the overall auction draft issue. I’m back home in 2 days and will be vigilant on any draft issues through April, when capacity drops considerably and we return to the predictable, boring, wonderful grind of a new baseball season. I hope this has been helpful, and please let me know if you have any further questions or concerns.