Improve energy use estimates for dates prior to very late August '13

Before then we only recorded charge state while we were charging - which means
if streaming data is missing the charge data give very misleading results for
energy used. By making sure that we don't take the next day's values for the
end of intervall computation we make the incorrect results at least somewhat
more realistic.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simpify stats code

The same identical block of code is needed twice -> that should be in a
function for consistency and maintainability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First cut at weekly data

So far only from streaming, and only logging to console.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Finish adding weekly statistics

These make the issues around accuracy so much more obvious. But since our data
isn't any better, there's not much we can do...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add minimal profiling for stats

This shows just how much time we spend on the database query and later
processing.

I was hoping to be able to skip the sort step if the data is already sorted and
found out that it frequently isn't, even if the user hasn't touched the
database. The data appears to arrive out of order from Tesla.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix incorrect week number calculation (for US)

With this weeks start on Sunday and the correct "first day of week" is used to
visualize the data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Better labels for the weekly stats

And change the title of the page.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add tooltips for weekly chart

And remove unused code from the tooltip for daily chart.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Merge pull request #52 from dirkhh/weeklyStats

Weekly stats