emoncms / MyHomeEnergyPlanner

My Home Energy Planner - Open Source home energy assessment software based on emoncms framework + openbem
GNU Affero General Public License v3.0
22 stars 27 forks source link

Lightbulb counting error. #416

Closed ghost closed 5 years ago

ghost commented 5 years ago

Andrew's assessment re.320 is showing number of energy efficient light-bulbs added as 0, even though 1 has been added.

Suggests there is an error in the calcs somewhere. Please could you have a look? Thanks!

cagabi commented 5 years ago

Hi,

As you could see in the report the measure was there but the quantity of bulbs was zero. I have manually tweaked the assessment's data object in the import/export to change that so now it is showing ok in the report.

In terms of where the problem comes from, I think I have worked out what has happened. The code is quiet simple for this measure: when clicking "Apply measure Replace all with LLE" we calculate the difference of outlets and LE bulbs and the result is the quantity of bulbs to add to the measure. Not very much scope for error. But the problem is that if after applying the measure you click for a second time the "Apply measure button" the measure is applied again and the quantity of LE bulbs is recalculated and pf course that is 0.

To avoid this in future situations the "Apply measure " button is disabled if the number of outlets is the same than the LE bulbs.