aboutsummaryrefslogtreecommitdiff
path: root/web/views
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-12 19:01:29 +0200
committerJochen Topf <jochen@topf.org>2014-09-12 19:01:29 +0200
commita46c746f72a932d93a7854330ce42c4b870c78d9 (patch)
tree0bd889753b63373f0cd4ba96dcbd190cf19aa7d0 /web/views
parent026bc7cf6cb062254054c70a46bbf4169cf60be0 (diff)
downloadtaginfo-a46c746f72a932d93a7854330ce42c4b870c78d9.tar
taginfo-a46c746f72a932d93a7854330ce42c4b870c78d9.tar.gz
Bugfix: Avoid NaN on embed/tag pages.
Fixes #72.
Diffstat (limited to 'web/views')
-rw-r--r--web/views/embed/tag.erb6
1 files changed, 3 insertions, 3 deletions
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 @@
<tr>
<td class="ft"><img src="/img/types/node.16.png" width="16" height="16" alt="Nodes" title="Nodes with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"></td>
<td class="ft" title="Nodes with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"><%= @dbtag['count_nodes'].to_i.to_s_with_ts %></td>
- <td title="Fraction of all nodes with key '<%= escape_html(@key) %>'"><%= '%.2f' % (@dbtag['count_nodes'].to_f / @dbkey['count_nodes'].to_f * 100) %>&thinsp;%</td>
+ <td title="Fraction of all nodes with key '<%= escape_html(@key) %>'"><%= @dbkey['count_nodes'] == 0 ? '0' : ('%.2f' % (@dbtag['count_nodes'].to_f / @dbkey['count_nodes'].to_f * 100)) %>&thinsp;%</td>
</tr>
<tr>
<td class="ft"><img src="/img/types/way.16.png" width="16" height="16" alt="Ways" title="Ways with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"></td>
<td class="ft" title="Ways with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"><%= @dbtag['count_ways'].to_i.to_s_with_ts %></td>
- <td title="Fraction of all ways with key '<%= escape_html(@key) %>'"><%= '%.2f' % (@dbtag['count_ways'].to_f / @dbkey['count_ways'].to_f * 100) %>&thinsp;%</td>
+ <td title="Fraction of all ways with key '<%= escape_html(@key) %>'"><%= @dbkey['count_ways'] == 0 ? '0' : ('%.2f' % (@dbtag['count_ways'].to_f / @dbkey['count_ways'].to_f * 100)) %>&thinsp;%</td>
</tr>
<tr>
<td class="ft"><img src="/img/types/relation.16.png" width="16" height="16" alt="Relations" title="Relations with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"></td>
<td class="ft" title="Relations with tag '<%= escape_html(@key) %>=<%= escape_html(@value) %>' in database"><%= @dbtag['count_relations'].to_i.to_s_with_ts %></td>
- <td title="Fraction of all relations with key '<%= escape_html(@key) %>'"><%= '%.2f' % (@dbtag['count_relations'].to_f / @dbkey['count_relations'].to_f * 100) %>&thinsp;%</td>
+ <td title="Fraction of all relations with key '<%= escape_html(@key) %>'"><%= @dbkey['count_relations'] == 0 ? '0' : ('%.2f' % (@dbtag['count_relations'].to_f / @dbkey['count_relations'].to_f * 100)) %>&thinsp;%</td>
</tr>
</table></div>
<% end %>