-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Survey with conditional getting stuck in a loop #169
Comments
Thanks I'll take a look at it. I might even suggest this approach of making a separate repo with an example survey in it for people to post issues because it makes it a lot easier to debug. With two files (survey.qmd and app.R), it's hard to fully describe the issue. |
Okay, I can confirm there is a bug here. I heavily simplified your example to narrow it down to the issue at hand: reprex-jph.zip I've also broken down my response here into sections. This is lengthy, but it's a bit complicated so it requires a lot of explanation. Understanding the issueIn my simplified demo, I have 4 pages: On But if on input$question1 == 'page2' ~ "page2" This logic evaluates as Where the problem is occurring is in the if (condition_result & (current_page_id != rule$target)) {
return(rule$target)
} This handles two conditions, both of which must be The first condition is the evaluated result of the The second condition checks that we're not already on the target page, which prevents us from getting stuck on the target page forever. This is why you are allowed to go on to Searching for a solutionRestricting skipping to only skip forwardOne idea is that we could restrict the skip logic such that if the skip target is already past, it gets ignored, which means we could only use the skip logic to skip forward in the survey. This is pretty easy to implement. We know the order of the page ids, so we could add an additional check to see if This would solve this immediate example, but it might be overly restrictive. For example, what if we had a survey where on input$question_change == 'yes' ~ "page2" But here the skip target ( 1) Split
|
@pingfan-hu what do you think? I'm leaning towards breaking up |
Yes professor, I tried the repo of @sagesteppe and did find out the problem, and yes, it's because of we are trying to go back to a previous page, which violates the conditions I have 2 reasons for that:
So our solution can both embrace a new feature but keep the old instances safe. |
I'm still leaning towards having two separate functions, mostly because I like the input$question1 == 'page2' ~ list(target = "page2", direction = "backward") We could use For most cases, the default direction would be "forward", so maybe for those cases we don't specify anything at all. With that idea, maybe we could do something like this: input$question1 == 'page2' ~ c(target = "page2", backwards = TRUE) In this case the default would be In contrast, if we change |
Yup it's better to separate them, and I forgot we could do depreciation. |
Okay let's table this for a future version. It's important, but we have a lot of changes to include already in the next version. Once we get that one merged, we can update this. |
Bug description
Hey -first off sorry getting I'm caught up with the new GH issues thing.
Hey! Loving the package so far but I keep coming across a recurring snag.
I use one conditional question to dispatch users to one of 12 sets of questions. Each of these sets are essentially identical. At the end of these 4 questions, users from each of the 12 sets should be able to go to the 'end' screen and exit survey. However usually when I take the test survey, I get caught in a loop where instead of going to 'end' or a later question in the parallel series I go back to the first question in the set.
I've made a reprex which will do a similar thing below. However, the formatting in these boxes has some issues, so I've put everything up into a repo so you can take a look or clone the results - Sorry the formatting is pretty abysmal now.
git@github.com:sagesteppe/ReprexSurvey.git
https://github.com/sagesteppe/ReprexSurvey.git
Any idea what the issue is? Typically the survey will go to the last question in a section, in this case the one about Ringo, before bouncing back to the start of the section.
Steps to reproduce
git@github.com:sagesteppe/ReprexSurvey.git
Run app, and after clicking through the live survey you should realize you are in a loop.
Expected behavior
Should be able to exit the survey through the 'end'
Actual behavior
loops
Your environment
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/Chicago
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.4.2 tools_4.4.2 rstudioapi_0.17.1
$mode
[1] "desktop"
$version
[1] ‘2024.9.1.394’
$long_version
[1] "2024.09.1+394"
$release_name
[1] "Cranberry Hibiscus"
The text was updated successfully, but these errors were encountered: