Skip to content

Commit

Permalink
Merge pull request #65 from ttscience/59-fixes-get-endpoints
Browse files Browse the repository at this point in the history
Optimization improvement
  • Loading branch information
lwalejko authored Feb 20, 2024
2 parents 2c8eb53 + f6b70cc commit e94c746
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions R/api_get_study.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ api_get_study <- function(res, req) {
api_get_study_records <- function(study_id, req, res) {
db_connection_pool <- get("db_connection_pool")

study_id <- req$args$study_id

is_study <-
checkmate::test_subset(
x = req$args$study_id,
choices = dplyr::tbl(db_connection_pool, "study") |>
dplyr::select(id) |>
dplyr::pull()
checkmate::test_true(
dplyr::tbl(db_connection_pool, "study") |>
dplyr::filter(id == study_id) |>
dplyr::collect() |>
nrow() > 0
)

if (!is_study) {
Expand Down

0 comments on commit e94c746

Please sign in to comment.