Skip to content

Commit

Permalink
more permissive checks
Browse files Browse the repository at this point in the history
  • Loading branch information
marton-balazs-kovacs committed May 27, 2022
1 parent 2093bcf commit 14d419e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
11 changes: 8 additions & 3 deletions R/mod_check_modal.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ mod_check_modal_server <- function(id, table_data){

# Create output
if (all(check_result$type %in% c("warning", "success"))) {
valid_contributors_table <- TRUE
is_valid <- TRUE
} else {
valid_contributors_table <- FALSE
is_valid <- FALSE
}

# Pass output
return(valid_contributors_table)
return(
list(
is_valid = is_valid,
check_result = check_result
)
)
})
}

Expand Down
11 changes: 8 additions & 3 deletions R/mod_read_spreadsheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod_read_spreadsheet_server <- function(id) {
# Hide show spreadsheet on start
golem::invoke_js("hideid", "show-div")

# Control show spreadsheet button behaviour based on read
# Control show spreadsheet button behavior based on read
observe({
if(!is.null(table_data())) {
golem::invoke_js("reable", "#show_spreadsheet-show_data")
Expand All @@ -120,10 +120,14 @@ mod_read_spreadsheet_server <- function(id) {

# General validation of contributors_table ---------------------------
# Alert modal to check contributors_table validity
check_output <- reactive({
req(table_data())
mod_check_modal_server("check_modal", table_data = table_data())
})

is_valid <- reactive({
if (!is.null(table_data())) {
check_output <- mod_check_modal_server("check_modal", table_data = table_data())
return(check_output)
return(check_output()$is_valid)
} else {
return(FALSE)
}
Expand All @@ -144,6 +148,7 @@ mod_read_spreadsheet_server <- function(id) {
list(
data = table_data_clean,
is_valid = is_valid,
check_result = reactive(check_output()$check_result),
upload = reactive(input$upload)
))
})
Expand Down
1 change: 1 addition & 0 deletions dev/02_dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ golem::add_module(name = "about_modal")
golem::add_module(name = "contribs_affiliation_page")
golem::add_module(name = "check_modal")
golem::add_module(name = "grant_information")
golem::add_module(name = "feedback")

## 2.2 Add dependencies

Expand Down
4 changes: 3 additions & 1 deletion man/check_duplicate_initials.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14d419e

Please sign in to comment.