dlamotte / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

font_size while the usage of a tag is 100% is not calculated #262

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Function calculate_cloud:239 in file utils.py.

If you use a tag for each record (100%), so tag_weight for given tag  equals 
max_weight, in my case it equaled 26.0, thresholds[steps-1] also equaled 26.0.

But the comparison of tag_weight <= thresholds[i] returned False.

Probably it is well-known problem of floating point numbers.

I’ve changed  the comparison
if not font_set and tag_weight <= thresholds[i]:
for 
if not font_set and float(str(tag_weight)) <= float(str(thresholds[i])):

And this has solved the problem

Original issue reported on code.google.com by SunFun...@gmail.com on 23 May 2011 at 8:25