bug in undelivered segments

Look, @cheddar, I created a branch for you ;)

There's a bug in the undelivered segments. I think it goes something like this: the last segment of a particular collection of undelivered segments (that is, the collection matching a single temp basal that stretches across two or more scheduled segments) is too long - it stretches to the beginning of the next scheduled segment instead of to the end of the temp segment. This was hard to see the consequences of in the viz because the effect is just the extension of a dotted line *under* another line, but I do need the undelivered segments to be accurate for filling in the right info in the tooltips.

This is blocking me finishing the basal tooltips, so if you can fix it, that'd be great. Otherwise I'll work on other stuff for a while and come back to it when I can.

Thanks again for your help with this!