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

[tor-commits] [metrics-web/master] Stop hard-coding versions.



commit c8a3414347c8df7aed3e63be4c704f1dd43aded4
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Jan 7 09:59:18 2019 +0100

    Stop hard-coding versions.
---
 src/main/R/rserver/graphs.R | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/R/rserver/graphs.R b/src/main/R/rserver/graphs.R
index 03b5b93..d3ea90a 100644
--- a/src/main/R/rserver/graphs.R
+++ b/src/main/R/rserver/graphs.R
@@ -381,18 +381,18 @@ write_networksize <- function(start_p = NULL, end_p = NULL, path_p) {
 }
 
 prepare_versions <- function(start_p, end_p) {
-  read.csv(paste(stats_dir, "versions.csv", sep = ""),
-    colClasses = c("date" = "Date")) %>%
+  read_csv(paste(stats_dir, "versions.csv", sep = ""),
+      col_types = cols(
+        date = col_date(format = ""),
+        version = col_character(),
+        relays = col_double())) %>%
     filter(if (!is.null(start_p)) date >= as.Date(start_p) else TRUE) %>%
     filter(if (!is.null(end_p)) date <= as.Date(end_p) else TRUE)
 }
 
 plot_versions <- function(start_p, end_p, path_p) {
   s <- prepare_versions(start_p, end_p)
-  known_versions <- c("Other", "0.1.0", "0.1.1", "0.1.2", "0.2.0",
-        "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7",
-        "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4",
-        "0.3.5")
+  known_versions <- unique(s$version)
   getPalette <- colorRampPalette(brewer.pal(12, "Paired"))
   colours <- data.frame(breaks = known_versions,
     values = rep(brewer.pal(min(12, length(known_versions)), "Paired"),

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