Skip to content

Commit

Permalink
Merge pull request nationalparkservice#55 from RobLBaker/master
Browse files Browse the repository at this point in the history
quick fix to force = false title search
  • Loading branch information
RobLBaker authored Nov 20, 2023
2 parents f415611 + fe08795 commit 39c4a6c
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions R/datastore_interactions.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,23 @@ create_datastore_script <- function(owner,

#search for title in title list, if force == false:
if(force == FALSE){
matches <- items %>% filter(stringr::str_detect(items$title, new_ref_title))
if(length(seq_along(matches$title) > 0)){
cat("One or more DataStore references with title containing: ",
new_ref_title,
" already exists:", sep="")
cat("Reference ID: ",
matches$referenceId,
"; Title: ",
matches$title, sep="")
cat("Are you sure you want to create a new draft reference for ",
new_ref_title, "?", sep = "")
var1 <- readline(prompt = cat("\n\n1: Yes\n2: No\n\n"))
if(var1 == 2){
cat("Your have not generated a new DataStore refernce.")
return()
if(length(items) > 0){
matches <- items %>% filter(stringr::str_detect(items$title, new_ref_title))
if(length(seq_along(matches$title) > 0)){
cat("One or more DataStore references with title containing: ",
new_ref_title,
" already exists:", sep="")
cat("Reference ID: ",
matches$referenceId,
"; Title: ",
matches$title, sep="")
cat("Are you sure you want to create a new draft reference for ",
new_ref_title, "?", sep = "")
var1 <- readline(prompt = cat("\n\n1: Yes\n2: No\n\n"))
if(var1 == 2){
cat("Your have not generated a new DataStore refernce.")
return()
}
}
}
}
Expand Down

0 comments on commit 39c4a6c

Please sign in to comment.