#' jira_sprint_review
#'
#' Rework the Jira issues data set from the API for use in a sprint review dashboard
#' @param issues The issues data frame
#' @param changelog The changelog data frame
#' @param sprint The name of the sprint
#' @seealso \code{\link{jira_issues}} which pulls the underlying data set
#' @export
jira_sprint_review <- function(issues,changelog,sprint) {
require(neugelbtools)
require(tidyverse)
sprint_issues <- issues %>%
filter(sprint_name == sprint)
#get some useful vectors
spishes <- quick_pull(sprint_issues,'key')
spr_start <- quick_pull(sprint_issues,'sprint_start_date')
spr_end <- quick_pull(sprint_issues,'sprint_end_date')
if (length(spr_start) > 1) {
spr_start <- spr_start[[1]]
}
if (length(spr_end) > 1) {
spr_end <- spr_end[[1]]
}
#filter the changelog
sprint_changes <- changelog %>%
filter(issue %in% spishes)
if (!is.na(spr_start) & !is.na(spr_end)) {
sprint_changes <- sprint_changes %>%
mutate(during_sprint = between(change_time,spr_start,spr_end))
#set the start of the sprint
sprint_starts <- sprint_changes %>%
filter(during_sprint == FALSE) %>%
group_by(issue) %>%
filter(change_time == max(change_time)) %>%
mutate(change_time = as.POSIXct(paste(spr_start,'00:00:00')),
change_from = change_to,
change_to = '(sprint start)',
days_difference = 0,
during_sprint = TRUE) %>%
ungroup()
#set the end of the sprint
sprint_ends <- sprint_changes %>%
group_by(issue) %>%
filter(change_time == max(change_time)) %>%
mutate(change_time = as.POSIXct(paste(spr_end,'23:59:59')),
change_from = change_to,
change_to = '(sprint end)',
days_difference = 0,
during_sprint = TRUE) %>%
ungroup() %>%
filter(!change_from %in% c('Done','Duplicate','Descoped'))
#implement the changes to the sprint data set
sprint_changes2 <- sprint_changes %>%
bind_rows(sprint_starts,sprint_ends) %>%
filter(during_sprint == TRUE) %>%
arrange(desc(start_date),issue,change_time) %>%
group_by(issue) %>%
mutate(days_difference = round(ifelse(min(change_time)==change_time,0,as.numeric(difftime(change_time,lag(change_time),units='days'))),4)) %>%
ungroup() %>%
arrange(desc(start_date),desc(issue),desc(change_time))
} else {
sprint_changes2 <- sprint_changes
}
#get all of the useful extra info
relevant_info <- sprint_issues %>%
select(key,summary_value,issuetype_name,team_name,priority_name,status_name,status_category_name,components,
story_points,labels,sprint_name,sprint_start_date,sprint_end_date,
assignee_display_name,assignee_email_address,reporter_display_name,reporter_email_address,
is_resolved,creation_to_resolution) %>%
mutate_all(~ nullToNA(.)) %>%
mutate(os = ifelse(str_detect(str_to_upper(labels),'IOS') == TRUE & str_detect(str_to_upper(labels),'ANDROID') == TRUE,'Both',
ifelse(str_detect(str_to_upper(labels),'IOS') == TRUE, 'iOS',
ifelse(str_detect(str_to_upper(labels),'ANDROID')==TRUE,'Android',
ifelse(str_detect(str_to_upper(labels),'BACKEND')==TRUE,'Backend',NA))))) %>%
mutate(clean_labels = map(labels,labels_cleaner)) %>%
unnest(clean_labels) %>%
mutate(clean_components = map(components,components_cleaner)) %>%
unnest(clean_components) %>%
select(-labels,-components)
#join it together
sprint_changes2 <- sprint_changes2 %>%
left_join(relevant_info, by=c('issue'='key')) %>%
filter(!change_to == '(sprint end)', !change_to=='(sprint start)')
return(sprint_changes2)
}
#' jira_sprint_review_all
#'
#' Get all the sprint reviews
#' @param issues The issues data frame
#' @param changelog The changelog data frame
#' @seealso \code{\link{jira_issues}} which pulls the underlying data set
#' @export
jira_sprint_review_all <- function(issues,changelog) {
require(tidyverse)
require(neugelbtools)
all_sprints <- quick_pull(issues,'sprint_name')
sprint_tbl <- tibble()
for (i in 1:length(all_sprints)) {
name <- all_sprints[[i]]
index <- i
if (is.na(name)) {
next()
} else {
temp <- jira_sprint_review(mba_issues$issues,mba_issues$changelog,name)
if (nrow(temp) == 0) {
next()
} else {
sprint_tbl <- bind_rows(sprint_tbl,temp)
}
}
}
return(sprint_tbl)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.