Skip to content

Commit

Permalink
add 'review_history' fn for #7
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Mar 20, 2024
1 parent c3ff31f commit 4ce67c1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 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.0.8.004
Version: 0.0.9
Authors@R:
person(given = "First",
family = "Last",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
export(add_editor_airtable_data)
export(editor_status)
export(editor_vacation_status)
export(review_history)
export(review_status)
11 changes: 7 additions & 4 deletions R/reviews.R
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ extract_comment_info <- function (dat) {
))
}

#' Apply the 'gh_issues_qry_dates_states' query to extract data from GitHub
#' GraphQL API, and post-process into a `data.frame`.
#' Generate historical data on software reviews.
#'
#' This is a reduced version of the `reviews_gh_data()` function, which returns
#' data only on dates of issue opening and closing, to be used to generate
Expand All @@ -438,8 +437,8 @@ extract_comment_info <- function (dat) {
#' @param quiet If `FALSE`, display progress information on screen.
#' @return (Invisibly) A `data.frame` with one row per issue and some key
#' statistics.
#' @noRd
reviews_gh_data_dates_states <- function (open_only = TRUE, quiet = FALSE) {
#' @export
review_history <- function (quiet = FALSE) {

has_next_page <- TRUE
end_cursor <- NULL
Expand Down Expand Up @@ -516,6 +515,7 @@ reviews_gh_data_dates_states <- function (open_only = TRUE, quiet = FALSE) {
closed_at <- closed_at [pkg_index]
submission_type <- submission_type [pkg_index]
state <- state [pkg_index]
labels <- labels [pkg_index]

# labels are then only used to identify stats submissions:
stats <- vapply (labels, function (i) "stats" %in% i, logical (1L))
Expand All @@ -528,5 +528,8 @@ reviews_gh_data_dates_states <- function (open_only = TRUE, quiet = FALSE) {
closed_at = lubridate::date (lubridate::ymd_hms (closed_at))
) |> dplyr::arrange (number)

dtime <- lubridate::interval (res$opened_at, res$closed_at)
res$duration_days <- as.numeric (dtime) / (24 * 3600)

return (res)
}
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.0.8.004",
"version": "0.0.9",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
20 changes: 20 additions & 0 deletions man/review_history.Rd

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

0 comments on commit 4ce67c1

Please sign in to comment.