Skip to content

Commit

Permalink
export 'rev_hours_airtable' for #37
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jul 3, 2024
1 parent 7cd830f commit 1c4e5e5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 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.2.2.036
Version: 0.2.2.037
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 @@ -4,6 +4,7 @@ export(add_editor_airtable_data)
export(ed_rev_durations)
export(editor_status)
export(editor_vacation_status)
export(rev_hours_airtable)
export(review_history)
export(review_status)
importFrom(memoise,memoise)
20 changes: 12 additions & 8 deletions R/review-history.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,25 @@ review_history <- function (quiet = FALSE) {

m_review_history <- memoise::memoise (review_history)

rev_dur_airtable <- function () {
#' Generate historical data on logged review times in hours from airtable database.
#'
#' @return A `data.frame` with one row per issue and some key statistics.
#' @export
rev_hours_airtable <- function () {

rev_dur <- airtabler::airtable (
rev_hours <- airtabler::airtable (
base = airtable_base_id, table = "reviews"
)
fields <- list ("id_no", "packages", "review_hours", "onboarding_url")
rev_dur <-
rev_dur$`reviews`$select_all (fields = fields)
rev_hours <-
rev_hours$`reviews`$select_all (fields = fields)
# airtable 'id_no' fields do not all equal actual issue numbers
# (for example, id_no = 217 is for issue #214).
rev_dur$number <- as.integer (gsub ("^.*\\/", "", rev_dur$onboarding_url))
rev_dur$review_hours <- as.numeric (rev_dur$review_hours)
rev_dur <- rev_dur [which (!is.na (rev_dur$number) & !is.na (rev_dur$review_hours)), ]
rev_hours$number <- as.integer (gsub ("^.*\\/", "", rev_hours$onboarding_url))
rev_hours$review_hours <- as.numeric (rev_hours$review_hours)
rev_hours <- rev_hours [which (!is.na (rev_hours$number) & !is.na (rev_hours$review_hours)), ]

rev_hist <- m_review_history (quiet = TRUE)
dplyr::left_join (rev_dur, rev_hist, by = "number") |>
dplyr::left_join (rev_hours, rev_hist, by = "number") |>
dplyr::select (number, review_hours, state, stats, editor, opened_at, closed_at, duration_days)
}
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.2.2.036",
"version": "0.2.2.037",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
14 changes: 14 additions & 0 deletions man/rev_hours_airtable.Rd

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

0 comments on commit 1c4e5e5

Please sign in to comment.