PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
266 stars 208 forks source link

Create a wrapper for a timed exercise group #1814

Open bnmnetp opened 2 years ago

bnmnetp commented 2 years ago

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:

Screen Shot 2022-08-19 at 5 38 15 PM

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:

So many years of technical debt over these negative attributes!! 😦

rbeezer commented 2 years ago

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.

bnmnetp commented 2 years ago

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.

rbeezer commented 2 years ago

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?

bnmnetp commented 2 years ago

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.

rbeezer commented 2 years ago

Right. I'll adjust in a bit.

rbeezer commented 2 years ago

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.

bnmnetp commented 2 years ago

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.

bnmnetp commented 2 years ago

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.

Screen Shot 2022-08-23 at 10 45 15 AM
bnmnetp commented 2 years ago

But now there is this to figure out....

Screen Shot 2022-08-23 at 10 50 45 AM
bnmnetp commented 2 years ago

Better...

Screen Shot 2022-08-23 at 12 40 50 PM
rbeezer commented 2 years ago

Looking good! ;-)