[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/master] Fix display bug when we're missing user estimates.



commit 9c06f1c683b0dc6d2db02a2ea2c59eb014a13c59
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Oct 7 10:41:47 2014 +0200

    Fix display bug when we're missing user estimates.
---
 website/rserve/tables.R       |    1 +
 website/web/WEB-INF/users.jsp |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/website/rserve/tables.R b/website/rserve/tables.R
index a22ceb5..f298c62 100644
--- a/website/rserve/tables.R
+++ b/website/rserve/tables.R
@@ -10,6 +10,7 @@ write_userstats <- function(start, end, node, path) {
          c$transport == '' & c$version == '' & c$node == node, ]
   u <- data.frame(country = c$country, users = c$clients,
                   stringsAsFactors = FALSE)
+  u <- u[!is.na(u$users), ]
   u <- aggregate(list(users = u$users), by = list(country = u$country),
                  mean)
   total <- sum(u$users)
diff --git a/website/web/WEB-INF/users.jsp b/website/web/WEB-INF/users.jsp
index 04eeaf9..b722564 100644
--- a/website/web/WEB-INF/users.jsp
+++ b/website/web/WEB-INF/users.jsp
@@ -89,7 +89,7 @@ Top-10 countries by directly connecting users:
   <c:forEach var="row" items="${userstats_relay_tabledata}">
     <tr>
       <td><a href="users.html?graph=userstats-relay-country&country=${row['cc']}#userstats-relay-country">${row['country']}</a>&emsp;</td>
-      <td>${row['abs']} (<fmt:formatNumber type="number" minFractionDigits="2" value="${row['rel']}" /> %)</td>
+      <td>${row['abs']} <c:if test="${row['rel'] != 'NA'}"> (<fmt:formatNumber type="number" minFractionDigits="2" value="${row['rel']}" /> %)</c:if></td>
     </tr>
   </c:forEach>
 </table>
@@ -204,7 +204,7 @@ Top-10 countries by bridge users:
   <c:forEach var="row" items="${userstats_bridge_tabledata}">
     <tr>
       <td><a href="users.html?graph=userstats-bridge-country&country=${row['cc']}#userstats-bridge-country">${row['country']}</a>&emsp;</td>
-      <td>${row['abs']} (<fmt:formatNumber type="number" minFractionDigits="2" value="${row['rel']}" /> %)</td>
+      <td>${row['abs']} <c:if test="${row['rel'] != 'NA'}"> (<fmt:formatNumber type="number" minFractionDigits="2" value="${row['rel']}" /> %)</c:if></td>
     </tr>
   </c:forEach>
 </table>

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits