I need your advice regarding the bug I once created here
Basically the reason is because it is converted to Javascript and comparison works well if
- the state does not contain a metric (and therefore only contains a number)
*and one of both has the type of Number
In the case a String (containing a number) is compared with a Number then Javascript converts the String into a Number and the comparison works.
So the reason why it works above in the first case is actually not the reason that is assigned to a variable but because the comparison is done agains a number.
So this all goes together with also the metrics comparison containing units. We would actually need some mechanism where we detect both operands and react accordingly.
@ysc:
I checked the blockly API and tried out several things but have found no way yet to intercept the code generation of the if-block.
What I could imagine though that we implement our own comparison block for OH that could handle that. Do have a better idea?