Skip to content

Commit

Permalink
remove pipe from server
Browse files Browse the repository at this point in the history
  • Loading branch information
arunge committed Nov 15, 2024
1 parent 35923ae commit c377d2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: InquiryR
Type: Package
Title: Inquiry app for expert elicitation
Version: 24.11.1
Version: 24.11.1.1
Authors@R: c(person("Antonia", "Runge", email = "antonia.runge@inwt-statistics.de", role = c("aut", "cre")))
Description: An app for creating Inquiry templates, conducting a survey, and downloading the results based on the shinysurveys package.
License: GPL (>= 3)
Expand Down
30 changes: 17 additions & 13 deletions inst/app/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ shinyServer(function(input, output, session) {
inquiry_template$title <- "Example Survey"
inquiry_template$description <- "This survey was generated from an example DataFrame."

inquiry_template$questions <- file.path("data", "example_questions.csv") %>%
read.csv() %>%
shinyTools::shinyTryCatch(errorTitle = "Reading example file failed", alertStyle = "shinyalert")
inquiry_template$questions <- shinyTools::shinyTryCatch(read.csv(file.path("data", "example_questions.csv")),
errorTitle = "Reading example file failed",
alertStyle = "shinyalert")

# notify user that the data frame was created
showNotification("An Inquiry Template has been loaded.", duration = 5)
Expand Down Expand Up @@ -108,21 +108,25 @@ shinyServer(function(input, output, session) {
div(
class = "survey-container",
# Survey output
shinysurveys::surveyOutput(
df = loaded_inquiry$questions %>% sanitizeQuestions(),
survey_title = loaded_inquiry$title,
survey_description = loaded_inquiry$description,
#theme = NULL # <- BUG: dependencies do not work if theme is NULL
theme = rgb(0, 0, 0, 0) # <- HACK: use transparent theme to avoid theme issues, because surveyOutput overwrites the style
) %>%
shinyTools::shinyTryCatch(errorTitle = "Loading the Inquiry failed", alertStyle = "shinyalert")
shinyTools::shinyTryCatch(
shinysurveys::surveyOutput(
df = sanitizeQuestions(loaded_inquiry$questions),
survey_title = loaded_inquiry$title,
survey_description = loaded_inquiry$description,
#theme = NULL # <- BUG: dependencies do not work if theme is NULL
theme = rgb(0, 0, 0, 0) # <- HACK: use transparent theme to avoid theme issues, because surveyOutput overwrites the style
),
errorTitle = "Loading the Inquiry failed",
alertStyle = "shinyalert"
)
)
})

observe({
req(isTRUE(survey_ui_created()))
shinysurveys::renderSurvey() %>%
shinyTools::shinyTryCatch(errorTitle = "Rendering the Inquiry failed", alertStyle = "shinyalert")
shinyTools::shinyTryCatch(shinysurveys::renderSurvey(),
errorTitle = "Rendering the Inquiry failed",
alertStyle = "shinyalert")
})

# Handle the Submit button action
Expand Down

0 comments on commit c377d2c

Please sign in to comment.