Skip to content

Commit

Permalink
handle breedbase case of trials in the root program folder
Browse files Browse the repository at this point in the history
  • Loading branch information
khaled-alshamaa committed Feb 25, 2024
1 parent a738619 commit 8139a65
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/qbms.R
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,19 @@ list_studies <- function() {

call_url <- sub("\\{trialDbId\\}", qbms_globals$state$trial_db_id, call_url)

# handle the case of BreedBase trials (studies) listed in the root program folder (trial)
if (qbms_globals$config$engine == "breedbase" && qbms_globals$state$trial_db_id == qbms_globals$state$program_db_id) {
call_url <- sub("\\?trialDbId\\=", '?programDbId=', call_url)
}

bms_trial_studies <- brapi_get_call(call_url, FALSE)$data

# handle the case of BreedBase trials (studies) listed in the root program folder (trial)
if (qbms_globals$config$engine == "breedbase" && qbms_globals$state$trial_db_id == qbms_globals$state$program_db_id) {
bms_trial_studies <- bms_trial_studies[is.na(bms_trial_studies$trialName), ]
rownames(bms_trial_studies) <- NULL
}

if (nrow(bms_trial_studies) == 0) {
stop("No studies in the selected trial! Please check what you have set in the `set_trial()` function")
}
Expand Down

0 comments on commit 8139a65

Please sign in to comment.