diff options
author | Mike Holmes <mike.holmes@linaro.org> | 2017-06-21 13:11:51 -0400 |
---|---|---|
committer | Mike Holmes <mike.holmes@linaro.org> | 2017-06-21 13:11:51 -0400 |
commit | a1489290db03d76b75c3ec087b40dab586c219a2 (patch) | |
tree | bab47a718d31554c2d65cf8163a86016752955e3 | |
parent | 2143333c900f258d55ebf869fd2c615fa5114f15 (diff) |
Report _spc with closed ommitted
-rw-r--r-- | member_heatmaps.R | 79 |
1 files changed, 78 insertions, 1 deletions
diff --git a/member_heatmaps.R b/member_heatmaps.R index c83ddff..58e2715 100644 --- a/member_heatmaps.R +++ b/member_heatmaps.R @@ -26,7 +26,7 @@ display_heatmap <- function(report, m, suffix) { #display raw data print(m) - cat("Generating", report_name) + cat("Generating", report_name,'\n') # following code limits the lowest and highest color to 5%, and 95% of your range, respectively quantile.range <- quantile(m, probs = seq(0, 1, 0.01)) @@ -78,6 +78,10 @@ watcher_heatmap <- function(report) { fields <- "/watchers" type <- "issue/" + + #TODO, get all the data + + names = list() for (key in keys) { url <- paste(baseurl, type, key, fields, sep = "") @@ -203,6 +207,78 @@ sponsor_heatmap <- function (report) { } +sponsor_heatmap_current <- function (report) { + baseurl <- "https://projects.linaro.org/rest/api/2/" + fields <- "&fields=customfield_10101,key,project" + type <- "search?" + + jql <- + paste( + "jql=project+in+(", + report["team"], + ")+AND+status!=Closed+AND+issuetype+in+(Initiative,Epic)&maxResults=1000", + sep = "" + ) + url <- paste(baseurl, type, jql, fields, sep = "") + cat (url,"\n") + + webpage <- curl (url, handle = h) + + #get data it into R + jira_raw <- fromJSON(webpage, simplifyDataFrame = TRUE) + #list of every issue + keys <- jira_raw$issues$key + + #x axis the number of projects + projects <- unique(jira_raw$issues$fields$project$key) + num_projects <- length(projects) + + #y axis the companies or sponsors + sponsor <- jira_raw$issues$fields$customfield_10101 + + names = list() + for (key in keys) { + s <- sponsor[[match (key, keys)]][[2]] + for (n in s) { + names[[length(names) + 1]] <- n + } + } + + #create empty matrix + comp <- unique(names) + num_comp <- length(comp) + m <- matrix(NA, nrow = num_comp, ncol = num_projects) + colnames(m) <- projects + rownames(m) <- comp + m[] <- 0L + + # count companies per project by looking at every key and update matrix + + for (key in keys) { + #y + mike <- match (key, keys) + team <- jira_raw$issues$fields$project$key[mike] + y <- match (team, projects) + + #x + s <- sponsor[[match (key, keys)]][[2]] + for (c in s) + { + x <- match (c, comp) + m[x, y] <- m[x, y] + 1 + } + } + + #remove companies we don't like ;) + rows.to.delete <- c('Linaro') + for (d in rows.to.delete) { + m <- as.matrix(m[!grepl(d, rownames(m)),]) + } + + display_heatmap(report, m, "_spc") + +} + #from the website get the initiatives list for the four teams id <- Sys.getenv(c("JIRA_USERNAME", "JIRA_PASSWORD")) @@ -237,6 +313,7 @@ reports <- apply(reports, 1, sponsor_heatmap) +apply(reports, 1, sponsor_heatmap_current) apply(reports, 1, watcher_heatmap) |