﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11166	{% widthratio 0 0 100 %} returns an empty string, rather than a 0	Ludwig Pettersson	nobody	"When supplying the {% widthratio %} template tag with both a value and max of 0 - you get an empty string returned (''), rather than a 0. Mathematically, this is correct - since typically division by zero results in undefined, but I wouldn't say this is the expected behaviour when using this to create charts, where a 0 rather than nothing, would be expected.

Example:
{{{
<img width=""{% widthratio 0 0 100 %}"" height=""10"" ... />
<img style=""width:{% widthratio 0 0 100 %}px; height:10px"" ... />
}}}

This would produce:
{{{
<img width="""" height=""10"" ... />
<img style=""width:px; height:10px"" ... />
}}}

Now, in the first example, the difference is only semantic - but the second one creates invalid css as well, not such a big of a deal, but, gets troublesome when you *need* a number returned, such as when using {% widthratio %} with the google charts api. (sparklines, for example, require a number between 0-100 - anything above 100, such as 550, is visually returned as 100 in the chart - so you can't have empty values.)

But, when would anyone ever encounter this problem? I personally do when displaying data over a time period, where in some cases, nothing may have happened - leaving everything at 0, both the values and max values - which then results in everything showing up empty, rather than defaulting back to 0.

I realize this is easy to work around, but I thought I would put it out there since at least I wasn't expecting this behavior and it seems a bit weird, especially when this is mainly used to create charts in templates.

(Patch is for the latest svn checkout as of this writing, rev 10833)"	Bug	closed	Template system	dev	Normal	fixed			Accepted	1	0	0	0	0	0
