pretext
pretext copied to clipboard
Create a wrapper for a timed exercise group
As per my conversation with Rob today at Drop-in:
Runestone has "timed assessments". which is basically a wrapper around a bunch of exercises where we render them as follows:
The html around the questions is simple:
<div class="timedAssessment ">
<ul data-component="timedAssessment" data-question_label="2.7.1" data-time=10 id="timed1" >
followed by the usual html for any questions
</ul>
</div>
The </ul> tag is dumb as we do not use <li> tags for any of the questions but that is how it is coded and it works.
additional attributes for the ul tag include:
data-no-resultwhich could have an attribute likeshow-results=data-no-timerwhich could have an attribute likeshow-timer=data-no-feedbackwhich could have an attribute likeshow-feedback=data-no-pausewhich could have an attribute likepause=
So many years of technical debt over these negative attributes!! 😦
Oh, ignore following. Author interface uses CLI and so lags my brand-new XSL.
How do I test a new server-only feature? Don't say "docker". ;-)
If I build locally with
~/mathbook/mathbook/pretext/pretext -vv -c all -f html
-p ~/mathbook/mathbook/examples/sample-book/publication-runestone-academy.xml
~/mathbook/mathbook/examples/sample-book/sample-book-noparts.xml
I get the wrapper I expect, with a data-time attribute.
Using author interface, new material in Section 5.7 (some timed exercises) appears. So push, build, deploy seems to have all happened. But page source lacks new wrapper, and nowhere on the page do I find data-time.
See f59e6cc226514d06ec62e32f83ba1b09f073e462 and c3edc0bca6ec65ef1424ddefb6c2bcf0c9afd0ed.
These do not need to be runestone server only.
It would be perfectly reasonable for an independent learner to want to take a quiz to check their learning. It just would not be recorded anywhere.
Please see: https://pretextbook.org/examples/sample-book/noparts/html/exercises-timed.html
I have "pause" turned off, but can get it to render when I change the attribute.
I'm guessing some of the PreTeXt infrastructure is in the way? An introduction is not rendering. And each RS exercise has some PTX infrastructure surrounding it.
Maybe the JS needs to cruise the main div looking a bit more carefully?
I'm seeing:
id="Timed ExercisesYou have 10 minutes to do these exercises when hosted online on a Runestone server.vector-space-dimension-timedmultiple-choice-not-randomized-timed" data-time="10" data-no-pause="">
That is clearly not the correct id.
Right. I'll adjust in a bit.
It was not working with a faux-id a while back. So that "improved" id was pretty bad, but with that fixed, still no introduction and no exercise.
There is a flash as the page loads where the exercise are visible.
And with a better id, the page now thinks I finished the exam with 0%. Well, really NaN%. (I think somebody is allowing division by zero?)
Try now, same URL as above.
Use localStorage.clear() to reset your exam.
I think I see the issue. When initializing the timed exam the children of the timedExam container have always directly been the .runestone divs around the question. But now there is a section and an article and a .PreTeXt-runestone-container that is confusing the code...
I think it would be better for me to make this code more flexible than to have you strip things away, but I'll investigate and we can talk later today.
Ok, progress and a nice easy backward compatible change. More work to do to show the extra text that students would see in a non-runestone server environment, but that can maybe wait for later as an enhancement.
But now there is this to figure out....
Better...
Looking good! ;-)