From a46c746f72a932d93a7854330ce42c4b870c78d9 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 12 Sep 2014 19:01:29 +0200 Subject: Bugfix: Avoid NaN on embed/tag pages. Fixes #72. --- web/views/embed/tag.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'web/views') diff --git a/web/views/embed/tag.erb b/web/views/embed/tag.erb index 5dca062..16b49f6 100644 --- a/web/views/embed/tag.erb +++ b/web/views/embed/tag.erb @@ -10,17 +10,17 @@ Nodes <%= @dbtag['count_nodes'].to_i.to_s_with_ts %> - <%= '%.2f' % (@dbtag['count_nodes'].to_f / @dbkey['count_nodes'].to_f * 100) %> % + <%= @dbkey['count_nodes'] == 0 ? '0' : ('%.2f' % (@dbtag['count_nodes'].to_f / @dbkey['count_nodes'].to_f * 100)) %> % Ways <%= @dbtag['count_ways'].to_i.to_s_with_ts %> - <%= '%.2f' % (@dbtag['count_ways'].to_f / @dbkey['count_ways'].to_f * 100) %> % + <%= @dbkey['count_ways'] == 0 ? '0' : ('%.2f' % (@dbtag['count_ways'].to_f / @dbkey['count_ways'].to_f * 100)) %> % Relations <%= @dbtag['count_relations'].to_i.to_s_with_ts %> - <%= '%.2f' % (@dbtag['count_relations'].to_f / @dbkey['count_relations'].to_f * 100) %> % + <%= @dbkey['count_relations'] == 0 ? '0' : ('%.2f' % (@dbtag['count_relations'].to_f / @dbkey['count_relations'].to_f * 100)) %> % <% end %> -- cgit v1.2.3