Skip to content

Commit

Permalink
Filter out deleted projects in scrape_user_api_tokens()
Browse files Browse the repository at this point in the history
  • Loading branch information
pbchase committed Aug 20, 2024
1 parent f9a5779 commit 1acff21
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions R/credential_management.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ scrape_user_api_tokens <- function(conn, username_to_scrape = Sys.info()[["user"
dplyr::tbl(conn, "redcap_projects") %>%
dplyr::select(
"project_id",
"app_title"
"app_title",
"date_deleted"
),
by = "project_id"
) %>%
dplyr::collect() %>%
# filter out deleted projects
dplyr::filter(is.na(.data$date_deleted)) |>
dplyr::select(-"date_deleted") |>
# bind_rows used over rbind to avoid need to align column order
dplyr::bind_rows(super_credentials) %>%
dplyr::rename(
Expand Down Expand Up @@ -125,12 +129,9 @@ set_project_api_token <- function(conn, username, project_id) {
DBI::dbExecute(conn, sql)
}



save_credentials <- function(
file_path,
project_id = "0",
token
) {
file_path,
project_id = "0",
token) {

}

0 comments on commit 1acff21

Please sign in to comment.