Skip to content

Commit

Permalink
use global airable_base_id param
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Apr 29, 2024
1 parent 372f232 commit 8af0e7c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 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.0.003
Version: 0.2.1
Authors@R:
person(given = "First",
family = "Last",
Expand Down
15 changes: 8 additions & 7 deletions R/editors-airtable.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
#' these indicate that an editor is away, on vacation, or otherwise unavailable,
#' then the `away` column will be set to `TRUE`.
#'
#' @param airtable_id The 'id' string of the airtable table.
#' @return A `data.frame` with one row per editor and information on current
#' vacation status.
#' @export
editor_vacation_status <- function () {
editor_vacation_status <- function (airtable_id) {

edvac_airtable <- edvac_status_airtable ()
edvac_airtable <- edvac_status_airtable (airtable_id)
slack_status <- get_slack_editors_status ()
vacation_ptn <- "away|vacation|holiday|unavailable"
vacation <- grep (vacation_ptn, slack_status$status, ignore.case = TRUE)
Expand All @@ -36,9 +37,9 @@ editor_vacation_status <- function () {
return (edvac)
}

edvac_status_airtable <- function () {
edvac_status_airtable <- function (airtable_id) {
editor_vacation <- airtabler::airtable (
base = "app8dssb6a7PG6Vwj", table = "editor-vacation-status"
base = airtable_id, table = "editor-vacation-status"
)
fields <- list ("editor", "Action", "Start Date", "Return Date")
editor_vacation <-
Expand All @@ -51,7 +52,7 @@ edvac_status_airtable <- function () {
edvac <- editor_vacation [which (index), ]

rev_prod <- airtabler::airtable (
base = "app8dssb6a7PG6Vwj", table = "reviewers-prod"
base = airtable_id, table = "reviewers-prod"
)
rev_prod <-
rev_prod$`reviewers-prod`$select_all (fields = list ("github", "name"))
Expand All @@ -75,9 +76,9 @@ edvac_status_airtable <- function () {
#' from \link{editor_status}.
#' @return A modified version of `editors` with additional columns.
#' @export
add_editor_airtable_data <- function (editors) {
add_editor_airtable_data <- function (editors, airtable_id) {
rev_prod <- airtabler::airtable (
base = "app8dssb6a7PG6Vwj", table = "reviewers-prod"
base = airtable_id, table = "reviewers-prod"
)
fields <- list ("github", "name", "editor", "other_langs", "domain_expertise")
rev_prod <- rev_prod$`reviewers-prod`$select_all (fields = fields)
Expand Down
6 changes: 4 additions & 2 deletions R/editors.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
airtable_base_id <- "app8dssb6a7PG6Vwj"

#' Get current status of all rOpenSci editors.
#'
#' @param aggregation_period The time period for aggregation of timeline for
Expand Down Expand Up @@ -352,13 +354,13 @@ editor_status <- function (quiet = FALSE, aggregation_period = "quarter") {
dplyr::arrange (dplyr::desc (inactive_days), .by_group = TRUE) |>
dplyr::ungroup ()

edvac <- editor_vacation_status () # in editors-airtable.R
edvac <- editor_vacation_status (airtable_base_id) # in editors-airtable.R
# Note that next line presumes slack 'name' == GitHub handle:
editors_on_vacation <- edvac$name [which (edvac$away)]
status$status [status$editor %in% editors_on_vacation] <- "ON LEAVE"

# Add additional columns from airtable data:
status <- add_editor_airtable_data (status)
status <- add_editor_airtable_data (status, airtable_base_id)

# Then editor timelines
month <- name <- NULL # Suppress no visible binding notes
Expand Down
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.0.003",
"version": "0.2.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
2 changes: 1 addition & 1 deletion man/add_editor_airtable_data.Rd

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

5 changes: 4 additions & 1 deletion man/editor_vacation_status.Rd

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

0 comments on commit 8af0e7c

Please sign in to comment.