-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add R/editors-airtable fn with ed_vacation_status for #7
- Loading branch information
Showing
5 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(editor_status) | ||
export(editor_vacation_status) | ||
export(review_status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#' Get current vacation status of all rOpenSci editors. | ||
#' | ||
#' @return A `data.frame` with one row per editor and information on current | ||
#' vacation status obtained from rOpenSci's airtable database. | ||
#' @export | ||
editor_vacation_status <- function (quiet = FALSE) { | ||
|
||
editor_vacation <- airtabler::airtable ( | ||
base = "app8dssb6a7PG6Vwj", table = "editor-vacation-status" | ||
) | ||
fields <- list ("editor", "Action", "Start Date", "Return Date") | ||
editor_vacation <- editor_vacation$`editor-vacation-status`$select_all (fields = fields) | ||
index <- vapply (editor_vacation$editor, function (i) length (i) > 0L, logical (1L)) | ||
edvac <- editor_vacation [which (index), ] | ||
|
||
rev_prod <- airtabler::airtable ( | ||
base = "app8dssb6a7PG6Vwj", table = "reviewers-prod" | ||
) | ||
rev_prod <- rev_prod$`reviewers-prod`$select_all (fields = list ("github", "name")) | ||
rev_prod <- rev_prod [match (edvac$editor, rev_prod$id), ] | ||
edvac$github <- rev_prod$github | ||
edvac$name <- rev_prod$name | ||
|
||
edvac$away <- FALSE | ||
s <- edvac$`Start Date` [2] | ||
index <- (!is.na (edvac$`Start Date`) & is.na (edvac$`Return Date`)) | | ||
as.Date (edvac$`Return Date`) > Sys.Date () | ||
index [which (is.na (index))] <- FALSE | ||
edvac$away [index] <- TRUE | ||
|
||
return (edvac) | ||
editors_on_vacation <- edvac$github [which (edvac$away)] | ||
ed_status$status [ed_status$editor %in% editors_on_vacation] <- "ON LEAVE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.