Skip to content

Commit

Permalink
add R/editors-airtable fn with ed_vacation_status for #7
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Mar 19, 2024
1 parent fdb2cd2 commit ecc23b2
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 10 deletions.
9 changes: 6 additions & 3 deletions 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.7
Version: 0.0.7.001
Authors@R:
person(given = "First",
family = "Last",
Expand All @@ -9,15 +9,18 @@ Authors@R:
Description: What the package does (one paragraph).
URL: https://github.com/ropensci-review-tools/dashboard
Imports:
airtabler,
dplyr,
gh,
gt,
lubridate,
memoise,
tidyr
Suggests:
testthat (>= 3.0.0)
Remotes:
bergant/airtabler
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
1 change: 1 addition & 0 deletions NAMESPACE
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)
34 changes: 34 additions & 0 deletions R/editors-airtable.R
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"
}
20 changes: 13 additions & 7 deletions 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.7",
"version": "0.0.7.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -46,6 +46,12 @@
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "airtabler",
"name": "airtabler",
"sameAs": "https://github.com/bergant/airtabler"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
Expand All @@ -57,7 +63,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=dplyr"
},
"2": {
"3": {
"@type": "SoftwareApplication",
"identifier": "gh",
"name": "gh",
Expand All @@ -69,7 +75,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=gh"
},
"3": {
"4": {
"@type": "SoftwareApplication",
"identifier": "gt",
"name": "gt",
Expand All @@ -81,7 +87,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=gt"
},
"4": {
"5": {
"@type": "SoftwareApplication",
"identifier": "lubridate",
"name": "lubridate",
Expand All @@ -93,7 +99,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=lubridate"
},
"5": {
"6": {
"@type": "SoftwareApplication",
"identifier": "memoise",
"name": "memoise",
Expand All @@ -105,7 +111,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=memoise"
},
"6": {
"7": {
"@type": "SoftwareApplication",
"identifier": "tidyr",
"name": "tidyr",
Expand All @@ -119,5 +125,5 @@
},
"SystemRequirements": null
},
"fileSize": "39.933KB"
"fileSize": "41.907KB"
}
15 changes: 15 additions & 0 deletions 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 ecc23b2

Please sign in to comment.