Skip to content

Commit

Permalink
return 'timeline_new' data for #8
Browse files Browse the repository at this point in the history
Plus update docs for 'editor_status' fn
  • Loading branch information
mpadge committed Mar 27, 2024
1 parent 643688b commit 3d55ff3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dashboard
Title: What the Package Does (One Line, Title Case)
Version: 0.1.3.001
Version: 0.1.3.002
Authors@R:
person(given = "First",
family = "Last",
Expand Down
37 changes: 26 additions & 11 deletions R/editors.R
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,23 @@ editor_reviews <- function (assignees, number, titles, state,
dplyr::arrange (tolower (assignees), number)
}

#' Generate a summary report of current state of all rOpenSci editors
#' Generate summary data of current and historical activities of all rOpenSci
#' editors
#'
#' @param aggregation_period The time period for aggregation of timeline for
#' editorial loads. Must be one of "month", "quarter", or "semester".
#' @param quiet If `FALSE`, display progress information on screen.
#' @return A `data.frame` with one row per issue and some key statistics.
#' @return A list of four items:
#' \itemize{
#' \item{'status', a `data.frame` of current editor status, with one row per
#' editor and some key statistics.}
#' \item{'timeline_total', a `data.frame` representing the timelines for each
#' editor of total concurrent editorial load.}
#' \item{'timeline_new', a `data.frame` representing the timelines for each
#' editor of editorial load of new issues opened in each time period (default of
#' quarter-year.}
#' \item{'reviews', a `data.frame` with one row per issue and some key
#' statistics.} }
#' @export

editor_status <- function (quiet = FALSE, aggregation_period = "quarter") {
Expand All @@ -323,8 +334,8 @@ editor_status <- function (quiet = FALSE, aggregation_period = "quarter") {
dat$latest$inactive_for <- dtime$dtime

# Suppress no visible binding notes:\
stats <- status <- updated_at <- editor <- state <- inactive_for <-
number <- inactive_days <- NULL
stats <- status <- updated_at <- editor <- inactive_for <-
inactive_days <- NULL

# desc status so "Free" before "Busy"
status <- dplyr::arrange (
Expand All @@ -338,13 +349,16 @@ editor_status <- function (quiet = FALSE, aggregation_period = "quarter") {

# Then editor timelines
month <- name <- NULL # Suppress no visible binding notes
timeline_total <- dat$timeline$issues_total
timeline_total$month <-
lubridate::ymd (paste0 (rownames (dat$timeline$issues_total), "-01"))
timeline_total <- tidyr::pivot_longer (timeline_total, cols = -month) |>
dplyr::arrange (tolower (name), month)
eds <- unique (timeline_total$name)
timeline_total$y <- match (timeline_total$name, eds)
process_timeline <- function (dat, what = "issues_total") {
what <- match.arg (what, c ("issues_total", "issues_new"))
timeline <- dat$timeline [[what]]
nms <- rownames (timeline)
timeline$month <- lubridate::ymd (paste0 (nms, "-01"))
timeline <- tidyr::pivot_longer (timeline, cols = -month) |>
dplyr::arrange (tolower (name), month)
}
timeline_total <- process_timeline (dat, what = "issues_total")
timeline_new <- process_timeline (dat, what = "issues_new")

# Finally, reviews for each editor
ed_rev <- split (dat$reviews, f = as.factor (dat$reviews$editor))
Expand All @@ -357,6 +371,7 @@ editor_status <- function (quiet = FALSE, aggregation_period = "quarter") {
return (list (
status = status,
timeline_total = timeline_total,
timeline_new = timeline_new,
reviews = ed_rev
))
}
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "dashboard: What the Package Does (One Line, Title Case)",
"codeRepository": "https://github.com/ropensci-review-tools/dashboard",
"license": "https://spdx.org/licenses/MIT",
"version": "0.1.3.001",
"version": "0.1.3.002",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
18 changes: 15 additions & 3 deletions man/editor_status.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3d55ff3

Please sign in to comment.