diff --git a/app.R b/app.R index c3c655f..681938d 100644 --- a/app.R +++ b/app.R @@ -342,8 +342,13 @@ server <- function(input, output, session) { this_nested_form_scheme <- mhcs()$get_scheme(values$nested_form_id) # мини-схема для ключа - this_nested_form_key_scheme <- subset(this_nested_form_scheme, form_id == key_id) - if (nrow(this_nested_form_key_scheme) > 1) cli::cli_abort("количество строк не может быть больше одного для ключа") + this_nested_form_key_scheme <- this_nested_form_scheme |> + dplyr::filter(form_id == {{key_id}}) + + this_nested_form_key_scheme_smoll <- this_nested_form_key_scheme |> + dplyr::distinct(form_id, form_label, form_type) + + if (nrow(this_nested_form_key_scheme_smoll) > 1) cli::cli_abort("количество строк не может быть больше одного для ключа") # выбираем все ключи из баз данных kyes_for_this_table <- db$get_nested_keys_from_table(values$nested_form_id, mhcs(), values$main_key, con) @@ -352,7 +357,7 @@ server <- function(input, output, session) { values$nested_key <- if (length(kyes_for_this_table) == 0) NULL else kyes_for_this_table[[1]] # если ключ в формате даты - дать человекочитаемые данные - if (this_nested_form_key_scheme$form_type == "date") { + if (this_nested_form_key_scheme_smoll$form_type == "date") { kyes_for_this_table <- setNames( kyes_for_this_table, format(as.Date(kyes_for_this_table), "%d.%m.%Y") @@ -390,7 +395,7 @@ server <- function(input, output, session) { width = 300, selectizeInput( inputId = "nested_key_selector", - label = strong(this_nested_form_key_scheme$form_label), + label = strong(this_nested_form_key_scheme_smoll$form_label), choices = kyes_for_this_table, selected = values$nested_key, # options = list(placeholder = "действие комиссии", create = FALSE, onInitialize = I('function() { this.setValue(""); }')) @@ -589,6 +594,8 @@ server <- function(input, output, session) { mhcs(), ns = NS(values$nested_form_id) ) + } else { + utils$clean_forms(values$nested_form_id, mhcs(), NS(values$nested_form_id)) } }) diff --git a/configs/schemas/example_of_scheme.xlsx b/configs/schemas/example_of_scheme.xlsx index 40e5723..e1d1c24 100644 Binary files a/configs/schemas/example_of_scheme.xlsx and b/configs/schemas/example_of_scheme.xlsx differ diff --git a/modules/global_options.R b/modules/global_options.R index d536810..a1e082b 100644 --- a/modules/global_options.R +++ b/modules/global_options.R @@ -5,7 +5,7 @@ set_global_options = function( APP.DEBUG = FALSE, # APP.FILE_DB = fs::path("data.sqlite"), shiny.host = "127.0.0.1", - shiny.port = 1337, + shiny.port = 1338, ... ) { options( diff --git a/modules/scheme_generator.R b/modules/scheme_generator.R index 4d66845..58a07f9 100644 --- a/modules/scheme_generator.R +++ b/modules/scheme_generator.R @@ -22,6 +22,10 @@ scheme_R6 <- R6::R6Class( check <- private$reserved_table_names %in% private$nested_forms_names if (any(check)) cli::cli_abort(c("нельзя использовать данные имена вложенных таблиц:", paste("- ", private$reserved_table_names[check]))) + # проверка на длину строк + check <- (nchar(private$nested_forms_names) > 31) + if (any(check)) cli::cli_abort(c("нельзя использовать имена длиной более 31 символа:", paste("- ", private$nested_forms_names[check]))) + purrr::walk( .x = purrr::set_names(private$nested_forms_names), .f = \(nested_form_id) { diff --git a/modules/utils.R b/modules/utils.R index 47503fa..9813b8c 100644 --- a/modules/utils.R +++ b/modules/utils.R @@ -263,7 +263,8 @@ update_forms_with_data = function( local_delimeter = getOption("SYMBOL_DELIM"), ns ) { - + + options(box.path = here::here()) box::use(modules/data_manipulations[is_this_empty_value]) # print("-----------------")