diff options
author | Mike Holmes <mike.holmes@linaro.org> | 2017-06-06 08:00:15 -0400 |
---|---|---|
committer | Mike Holmes <mike.holmes@linaro.org> | 2017-06-06 08:00:15 -0400 |
commit | 2fbf4670f918f421886bfe20963f8e57bd3c1d53 (patch) | |
tree | 2b7102c774ebb0c4711f5131546489b7c8339c0e | |
parent | 4b1bf3b3096bbe54bbbc99f48cac756a0986fdb7 (diff) |
add team mbr contributions
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
-rw-r--r-- | Signed_off_heatmaps.R | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/Signed_off_heatmaps.R b/Signed_off_heatmaps.R index b960769..ac0d235 100644 --- a/Signed_off_heatmaps.R +++ b/Signed_off_heatmaps.R @@ -24,13 +24,13 @@ get_tags <- function (id) { #get data it into R jira_tags_raw <- fromJSON(webpage,simplifyMatrix = TRUE, simplifyVector =TRUE, simplifyDataFrame = TRUE, flatten = TRUE) m <- data.frame(tag=jira_tags_raw$tag, person=jira_tags_raw$person) - + return(m) } get_signed <- function (df){ - return (length(grep("Signed-off", df$contribution$tag))) - } + return (length(grep("Signed-off", df$contribution$tag))) +} get_acked <- function (df){ return (length(grep("Acked", df$contribution$tag))) @@ -49,10 +49,8 @@ get_reported <- function (df){ } get_team_size <- function (df){ - str(df) unique_people <- unique(df$contributions$person) number_of_people <- length(unique_people) - print (number_of_people) return (number_of_people) } @@ -60,7 +58,6 @@ get_projects <- function (df){ return (df$contributions) } - #from the website get the initiatives list for the four teams id <- Sys.getenv(c("JIRA_USERNAME", "JIRA_PASSWORD")) @@ -83,8 +80,6 @@ handle_setopt(h, httpauth = 1) report_name <- c("signed_off") - - baseurl <- "http://patches.linaro.org/api/1.0/" type <- "teams/?format=json&per_page=5000" @@ -99,18 +94,14 @@ jira_raw <- fromJSON(webpage,simplifyMatrix = TRUE, simplifyVector =TRUE, simpl df <- data.frame(id=jira_raw$id, url=jira_raw$url, active=jira_raw$active) -row.names(df) <- jira_raw$display_name -#str(df) +row.names(df) <- as.character (jira_raw$display_name) n <- sapply(df$id,get_tags) -#str(n) - df$contributions <- n #remove inactive df <- df[df$active == TRUE,] - #table(n[[]]$project) #I am here getting bits out @@ -119,7 +110,7 @@ list.contributions <- do.call("rbind",df$contributions) unique.tags <- (unique(list.contributions$tag)) unique.persons <- (unique(list.contributions$person)) -unique.projects <- (unique(list.contributions)) +unique.projects <- (unique(row.names(df))) df$signed <- apply(df,1, get_signed) df$acked <- apply(df,1, get_acked) @@ -128,7 +119,6 @@ df$tested <- apply(df,1, get_tested) df$reported<- apply(df,1, get_reported) df$team_size<- apply(df,1, get_team_size) -print (df$team_size) #normalise by the number of contributors df$signed <- df$signed / df$team_size df$acked <- df$acked / df$team_size @@ -170,7 +160,6 @@ barplot(inverse.m, las=2, ) dev.off() - pdf(file="Linaro_team_vs_git.pdf", title = "team vs. git stats") op <- par(mar=c(15,4,4,2)) colours <- c("lightblue", "mistyrose", "lightcyan","lavender", "cornsilk") @@ -188,23 +177,48 @@ barplot(df$reported, las=2, main="reported", ylab = "number of patches", dev.off() cat ("-----------------------\n") -pdf(file="Linaro_team_vs_project.pdf", title = "team vs. git stats") - -#str(n) -nm <- data.frame(ncol=length(unique.projects), nrow=length(rownames(df))) -#colnames(nm) <- list.contributions -#rownames(nm) <- rownames(df) -cat ("-------nm----------------\n") -str(nm) -cat ("-----------------------\n") -str(list.contributions) +pdf(file="Linaro_team_members_contributions.pdf", title = "team vs. git stats") +op <- par(mfrow=c(1, 1), mar =c(15,4,4,10)) -for ( p in rownames(nm)) -{ - print(p) -} - -dev.off() +for (team in row.names(df)) { + contributions <- data.frame (df[team, ]$contribution) + + unique.tags <- (unique(contributions$tag)) + unique.persons <- (unique(contributions$person)) + all_people <- matrix(nrow=length(unique.persons), ncol=length(unique.tags)) + rownames(all_people) <- unique.persons + colnames(all_people) <- unique.tags + all_people[] <- 0L + + print ("-----team---------") + print(team) + print ("--------------") + + tab <- as.data.frame( table(contributions)) + for (r in 1:nrow(tab)) { + tag <- as.character(tab[r,"tag"]) + person <- as.character(tab[r,"person"]) + Freq <- (tab[r,"Freq"]) + all_people[person,tag] <- all_people[person,tag] + Freq + } + + barplot( + main = paste("Maintainers", team, sep = " "), + t(all_people), + las = 2, + bty='L', + col = colours, + legend.text = TRUE, + args.legend = list( + x='right', + bty='n', + inset=c(-0.45,0, + xpd=TRUE) + ) + ) +} + +dev.off() |