[tor-commits] [metrics-web/master] Take out nocutoff madness in user graphs.

karsten at torproject.org karsten at torproject.org
Fri Aug 31 07:54:54 UTC 2012


commit 801c31f881454408ad63c69dda18911a23a033c2
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri Aug 31 09:50:37 2012 +0200

    Take out nocutoff madness in user graphs.
    
    A recent change turned on that feature by default, which is a bug.  But
    it's a confusing feature anyway, so let's kill it.
---
 rserve/graphs.R                                    |    7 +----
 .../ernie/web/GraphParameterChecker.java           |   21 --------------------
 src/org/torproject/ernie/web/RObjectGenerator.java |    2 +-
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/rserve/graphs.R b/rserve/graphs.R
index 4f99eeb..f5bc089 100644
--- a/rserve/graphs.R
+++ b/rserve/graphs.R
@@ -664,11 +664,8 @@ plot_relayflags <- function(start, end, flags, granularity, path, dpi) {
   ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
 }
 
-plot_direct_users <- function(start, end, country, events, path, nocutoff,
-    dpi) {
-  if (nocutoff != "off") {
-    end <- min(end, as.character(Sys.Date() - 4))
-  }
+plot_direct_users <- function(start, end, country, events, path, dpi) {
+  end <- min(end, as.character(Sys.Date() - 4))
   drv <- dbDriver("PostgreSQL")
   con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
   q <- paste("SELECT date, r, bwp, brn, bwn, brp, bwr, brr, country ",
diff --git a/src/org/torproject/ernie/web/GraphParameterChecker.java b/src/org/torproject/ernie/web/GraphParameterChecker.java
index 19a4081..c939035 100644
--- a/src/org/torproject/ernie/web/GraphParameterChecker.java
+++ b/src/org/torproject/ernie/web/GraphParameterChecker.java
@@ -60,7 +60,6 @@ public class GraphParameterChecker {
     this.knownParameterValues.put("language", "all,en,zh_CN,fa");
     this.knownParameterValues.put("source", "all,siv,moria,torperf");
     this.knownParameterValues.put("filesize", "50kb,1mb,5mb");
-    this.knownParameterValues.put("nocutoff", "on,off");
     this.knownParameterValues.put("dpi", "72,150,300");
   }
 
@@ -292,26 +291,6 @@ public class GraphParameterChecker {
       }
     }
 
-    /* Parse whether the last day(s) of a time series should be cut off.
-     * This parameter can either be "on" or "off," where "off" is the
-     * default. */
-    if (supportedGraphParameters.contains("nocutoff")) {
-      String[] nocutoffParameter = (String[]) requestParameters.get(
-          "nocutoff");
-      List<String> knownValues = Arrays.asList(
-          this.knownParameterValues.get("nocutoff").split(","));
-      if (nocutoffParameter != null) {
-        if (nocutoffParameter.length != 1 ||
-            nocutoffParameter[0].length() == 0 ||
-            !knownValues.contains(nocutoffParameter[0])) {
-          return null;
-        }
-      } else {
-        nocutoffParameter = new String[] { "off" };
-      }
-      recognizedGraphParameters.put("nocutoff", nocutoffParameter);
-    }
-
     /* Parse graph resolution in dpi. The default is 72. */
     if (supportedGraphParameters.contains("dpi")) {
       String[] dpiParameter = (String[]) requestParameters.get("dpi");
diff --git a/src/org/torproject/ernie/web/RObjectGenerator.java b/src/org/torproject/ernie/web/RObjectGenerator.java
index e4e08bc..b964958 100644
--- a/src/org/torproject/ernie/web/RObjectGenerator.java
+++ b/src/org/torproject/ernie/web/RObjectGenerator.java
@@ -93,7 +93,7 @@ public class RObjectGenerator implements ServletContextListener {
     this.availableGraphs.put("bwhist-flags", "start,end,filename,dpi");
     this.availableGraphs.put("dirbytes", "start,end,filename,dpi");
     this.availableGraphs.put("direct-users",
-        "start,end,country,events,filename,nocutoff,dpi");
+        "start,end,country,events,filename,dpi");
     this.availableGraphs.put("bridge-users",
          "start,end,country,filename,dpi");
     this.availableGraphs.put("torperf",



More information about the tor-commits mailing list