fix build_metadata() if logic
This commit is contained in:
parent
135c5ca696
commit
5fb33d8df7
1 changed files with 5 additions and 5 deletions
|
|
@ -26,7 +26,11 @@ store_build_metadata <- function(
|
||||||
|
|
||||||
if (nrow(existing_entries) >= 1 && !force) {
|
if (nrow(existing_entries) >= 1 && !force) {
|
||||||
cli::cli_alert("{.fun store_build_metadata}: Build metadata for {.field {.pkg package_name}} {.field {tag}} already exists.")
|
cli::cli_alert("{.fun store_build_metadata}: Build metadata for {.field {.pkg package_name}} {.field {tag}} already exists.")
|
||||||
} else if (nrow(existing_entries) == 0 && !force) {
|
} else if (nrow(existing_entries) >= 1 && force) {
|
||||||
|
cli::cli_alert_info("{.fun store_build_metadata}: Force overwriting build metadata for {.field {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
|
||||||
|
|
||||||
|
dbExecute(con, sprintf("UPDATE single_builds SET build_timestamp = '%s' WHERE package_name = '%s' and tag = '%s'", format(Sys.time(), "%Y-%m-%d %H:%M:%S"), package_name, tag))
|
||||||
|
} else if (nrow(existing_entries) == 0) {
|
||||||
cli::cli_alert("{.fun store_build_metadata}: Storing build metadata for {.field {package_name}} {.field {tag}}.")
|
cli::cli_alert("{.fun store_build_metadata}: Storing build metadata for {.field {package_name}} {.field {tag}}.")
|
||||||
# Create a data frame with the metadata
|
# Create a data frame with the metadata
|
||||||
metadata <- data.frame(
|
metadata <- data.frame(
|
||||||
|
|
@ -39,10 +43,6 @@ store_build_metadata <- function(
|
||||||
)
|
)
|
||||||
# Write the data frame to the SQLite database
|
# Write the data frame to the SQLite database
|
||||||
dbWriteTable(con, "single_builds", metadata, append = TRUE)
|
dbWriteTable(con, "single_builds", metadata, append = TRUE)
|
||||||
} else if (nrow(existing_entries) >= 1 && force) {
|
|
||||||
cli::cli_alert_info("{.fun store_build_metadata}: Force overwriting build metadata for {.field {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
|
|
||||||
|
|
||||||
dbExecute(con, sprintf("UPDATE single_builds SET build_timestamp = '%s' WHERE package_name = '%s' and tag = '%s'", format(Sys.time(), "%Y-%m-%d %H:%M:%S"), package_name, tag))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Close the SQLite connection
|
# Close the SQLite connection
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue