Found a bug in zoom visualisation. Maybe solved.

Hi,

I'm running an emoncms server without Timestore. Just Mysql and Redis.

I'm doing some tests loading a bunch of data using curl calling a file with the input APIs.

Everything works fine, but I've discovered a bug in the "zoom" visualization: in the monthly view January is always missing the kWh of the first day, i.e. if I have 100 kWh/d for every day of January the value shown is 3000 kWh instead of 3100 kWh.

I tried with different datasets in order to be sure that it was the 1st of January the missing day.

I don't know much about php and javascript, anyway I tried to figure out what the problem was and I found that in function "get_months_year" in file Modules/vis/visualisations/common/daysmonthsyears.js we have:

data = get_range(data,Date.UTC(year,0,1),Date.UTC(year+1,0,1));

I tried instead the following

[EDIT]

data = get_range(data,Date.UTC(year,0,0),Date.UTC(year+1,0,1));

data = get_range(data,Date.UTC(year,0,0),Date.UTC(year+1,0,0));

This way it makes more sense.

[/EDIT]

and it apparently works.

Now, this seems too easy to be true. I'm afraid I'm missing some other side effect.

Could anyone please help me verifying if this patch can be adopted?

Thanks in advance.

Best regards,

Federico.

Jérôme's picture

Re: Found a bug in zoom visualisation. Maybe solved.

Hi.

Thanks for reporting this.

If you haven't got any answer in a few days, please consider filing an issue in Github.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.