Get timelimit from complete exercise object #494
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Edit: on second thought, we were just setting
timelimit
too early. Getting the timelimit after filling out theexercise
object fixes the issue in #492.This fixes #492. The exercise reactive returned by
input$`tutorial-exercise-%s-code-editor`
doesn't include all of the exercise options. It seems thatexercise_rx()
only contains thelabel
, the submittedcode
, atimestamp
and flags forrestore
andshould_check
. The result is that, whensetup_exercise_handler
tries to find$options$exercise.timelimit
, that field is alwaysNULL
because$options
isn't a item in the reactive exercise list.I'm not sure if that should be rectified in the exercise object logic, butI was able to fix the issue by merging the reactive exercise object with the cached exercise object that contains the complete options, check code, etc. (Edit: which we do later so we were just settingtimelimit
too eary.)Here's a reprex Rmd for testing. Prior to the change in this PR, learnr ignores both the chunk and global options and always caps exercises at 30 seconds. Both time-limit setting methods are demonstrated in the reprex.
PR task list:
devtools::document()