Skip to content

Commit

Permalink
Changes resulting from code review + fix for catching errors
Browse files Browse the repository at this point in the history
  • Loading branch information
salatak committed Feb 19, 2024
1 parent 7358b3c commit d76250a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions R/api_get_study.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
api_get_study <- function(res, req) {
db_connection_pool <- get("db_connection_pool")


study_list <-
dplyr::tbl(db_connection_pool, "study") |>
dplyr::select(study_id = id, identifier, name, method, last_edited = timestamp) |>
Expand All @@ -25,8 +24,7 @@ api_get_study_records <- function(study_id, req, res) {
if (!is_study) {
res$status <- 404
return(list(
error = "Study not found",
details = r$error
error = "Study not found"
))
}

Expand Down Expand Up @@ -82,7 +80,7 @@ api_get_study_records <- function(study_id, req, res) {
tidyr::pivot_wider(names_from = arm_name, values_from = ratio) |>
as.list()

study_list <-
study_elements <-
list(
strata = strata,
arms = arms
Expand All @@ -95,7 +93,7 @@ api_get_study_records <- function(study_id, req, res) {
jsonlite::fromJSON() |>
purrr::flatten_dfr() |>
dplyr::select(p, method),
study_list
study_elements
)

return(study_list)
Expand Down

0 comments on commit d76250a

Please sign in to comment.