From 707b91146744a90e9990a788ca3899068794c21e Mon Sep 17 00:00:00 2001 From: Johannes Boog <johannesboog@yahoo.de> Date: Fri, 9 Dec 2022 16:13:37 +0100 Subject: [PATCH] [bugfix] read in of value, dvalue on class prj_ph_property --- R/prj_medium.R | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/R/prj_medium.R b/R/prj_medium.R index fbbfb61..1c634ea 100644 --- a/R/prj_medium.R +++ b/R/prj_medium.R @@ -544,16 +544,22 @@ new_prj_ph_property <- function(name, are_strings(name, type) - if (is.list(value)) { - are_null_or_strings(value[[1]]) - } else { - are_null_or_numeric(value) + if (!is.null(value)) { + if(is.list(value)){ + assertthat::assert_that(names(value[1]) == "expression") + are_null_or_strings(value[[1]]) + }else{ + are_null_or_numeric(value) + } } if (!is.null(dvalue)) { + is_wrapper_list(dvalue, "list") dvalue <- lapply(dvalue, function(x){ - are_null_or_strings(x[[1]]) - x[[2]] <- coerce_string_to_numeric(x[[2]]) + assertthat::assert_that( + all(names(x) %in% c("variable_name", "expression"))) + are_null_or_strings(x[["variable_name"]]) + x[["expression"]] <- coerce_string_to_numeric(x[["expression"]]) return(x) }) } @@ -571,15 +577,6 @@ new_prj_ph_property <- function(name, are_null_or_strings(parameter_name, curve) - # if (!is.null(independent_variable)) { - # independent_variable <- lapply(independent_variable, function(x){ - # x <- coerce_names(x, - # c("variable_name", - # "reference_condition", - # "slope")) - # }) - # } - if (!is.null(exponent)) { exponent <- coerce_names(exponent, c("variable_name", @@ -763,4 +760,4 @@ new_prj_com_property <- function(name, ), class = "prj_com_property" ) -} +} \ No newline at end of file -- GitLab