Skip to content

Commit

Permalink
Fix #348: All exercises resolve to complete when one is completed (#384)
Browse files Browse the repository at this point in the history
* Fix #348: All exercises resolve to complete when one is completed

* Update news
  • Loading branch information
jcheng5 authored Jun 11, 2020
1 parent cdf7103 commit 9dfe4a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ learnr (development version)

* Properly enforce time limits and measure exercise execution times that exceed 60 seconds ([#366](https://github.com/rstudio/learnr/pull/366), [#368](https://github.com/rstudio/learnr/pull/368))
* Fixed unexpected behavior for `question_is_correct.learnr_text()` where `trim = FALSE`. Comparisons will now happen with the original input value, not the `HTML()` formatted answer value. ([#376](https://github.com/rstudio/learnr/pull/376))
* Fixed exercise progress spinner being prematurely cleared. ([#384](https://github.com/rstudio/learnr/pull/384))

learnr 0.10.1
===========
Expand Down
16 changes: 15 additions & 1 deletion inst/lib/tutorial/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,9 @@ Tutorial.prototype.$initializeExerciseEvaluation = function() {

renderValue: function renderValue(el, data) {

// See big comment in showProgress method, below.
thiz.$showExerciseProgress(exerciseLabel(el), null, false);

// remove default content (if any)
this.outputFrame(el).children().not($(el)).remove();

Expand All @@ -1425,7 +1428,18 @@ Tutorial.prototype.$initializeExerciseEvaluation = function() {
},

showProgress: function(el, show) {
thiz.$showExerciseProgress(exerciseLabel(el), null, show);
if (show) {
thiz.$showExerciseProgress(exerciseLabel(el), null, show);
} else {
// This branch is intentionally empty. You'd expect that we would call
// thiz.$showExerciseProgress(exerciseLabel(el), null, show);
// at this time, but we cannot due to a quirk in Shiny. Shiny assumes
// that when we receive a new value for one output, then all outputs are
// done; this is because all outputs are held and flushed together. I
// (jcheng) don't know enough about learnr to know why this assumption
// doesn't hold in this case, but it doesn't (issue #348). Instead, we
// need to use renderValue as a proxy for showProgress(false).
}
},

outputFrame: function(el) {
Expand Down

0 comments on commit 9dfe4a9

Please sign in to comment.