#' jira_status_time
#'
#' A function for calculating the amount of time spent in each status in Jira
#' @param changes_df The dataframe of all changelog info
#' @seealso \code{\link{jira_issues}} which pulls the underlying data set
#' @export
jira_status_time <- function(changes_df) {
require(tidyverse)
calc_time <- changes_df %>%
group_by(issue) %>%
mutate(is_most_recent = change_time == max(change_time)) %>%
ungroup() %>%
filter(is_most_recent == TRUE) %>%
select(-is_most_recent) %>%
mutate(days_difference = (as.numeric(Sys.time()) - as.numeric(change_time)) / 86400,
change_from = change_to,
change_to = '(current status)',
change_time = Sys.time(),
change_type = 'milestone')
changes2 <- bind_rows(changes_df,calc_time) %>%
arrange(desc(start_date),desc(issue),desc(change_time))
time_in_status <- changes2 %>%
filter(!is.na(change_from)) %>%
group_by(issue,change_from) %>%
summarize(days_in_status = sum(days_difference)) %>%
ungroup() %>%
rename(status = 2)
return(time_in_status)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.