tidepool-org/tideline — pull request #72 by nicolashery (2014-04-10 14:14:24+00:00)
Title: Avoid errors when receiving partial data sets

@jebeck When testing Blip I bumped into an error that stopped Tideline from rendering. I fixed it, and actually ended up testing different data sets and tried to make it so Tideline could render *something* (even if not always useful), and not crash.

I started with the full mock data set, and then tested both `oneday` and `twoweek`, with these variants:

1. no `basal-rate-segment`
2. no `bolus`
3. no `carbs`
4. no `cbg`
5. no `smbg`
6. no `message`

For each of these, if Tideline raised an error I went in and tried to fix it. As you'll see from the diff, it involves mostly things like `data = data || []`, `if (!(data && data.length))`, and setting default endpoints or scale domains.

Let me know what you think. Since I'm not familiar with Tideline's internals, you might have other suggestions.

Thanks!