Skip to content

Commit

Permalink
fix writing of tracker updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Raven Bot committed Mar 14, 2024
1 parent 1694a6d commit c3ce3e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gdrive.automation
Title: Sync and Automate C4R Unit Progress
Version: 0.9.5
Version: 0.9.6
Authors@R:
person("Hao", "Ye", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8630-1458"))
Expand Down
3 changes: 3 additions & 0 deletions R/gdrive.automation-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ utils::globalVariables(".data")
# board id for notifications
gdrv_auto_env.monday_board_id = "5704206865",

# column names for tracker statuses
gdrv_auto_env.statuses.columns = c("Unit", "Mini-Unit", "Phase", "Task", "Signoff by", "Status"),

# regex Pattern for Allowed Statuses
gdrv_auto_env.statuses.regex_pattern = "Submitted|Under review|Approved|Not started",

Expand Down
7 changes: 5 additions & 2 deletions R/interface_sheets.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ read_db_units <- function(id = getOption("gdrv_auto_env.URL_db_units"))
#' @export
read_tracker_statuses <- function(url, sheet = "unit 1")
{
statuses_colnames <- c("Unit", "Mini-Unit", "Phase", "Task", "Signoff by", "Status")
statuses_colnames <- getOption("gdrv_auto_env.statuses.columns")
c("Unit", "Mini-Unit", "Phase", "Task", "Signoff by", "Status")
result <- googlesheets4::read_sheet(url, sheet, skip = 1, trim_ws = FALSE) %>%
as_statuses()
stopifnot(identical(names(result), statuses_colnames))
Expand All @@ -36,8 +37,10 @@ read_tracker_statuses <- function(url, sheet = "unit 1")
#' @export
update_tracker_data <- function(tracker_dat, tracker_url, tracker_sheet)
{
statuses_colnames <- getOption("gdrv_auto_env.statuses.columns")
to_write <- dplyr::select(tracker_dat, statuses_colnames)
googlesheets4::range_write(tracker_url,
tracker_dat,
to_write,
tracker_sheet,
range = "A3",
col_names = FALSE,
Expand Down

0 comments on commit c3ce3e5

Please sign in to comment.