pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Create a wrapper for a timed exercise group

Open bnmnetp opened this issue 3 years ago • 11 comments
trafficstars

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:

  • data-no-result which could have an attribute like show-results=
  • data-no-timer which could have an attribute like show-timer=
  • data-no-feedback which could have an attribute like show-feedback=
  • data-no-pause which could have an attribute like pause=

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

bnmnetp avatar Aug 19 '22 22:08 bnmnetp

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.

rbeezer avatar Aug 22 '22 19:08 rbeezer

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.

bnmnetp avatar Aug 22 '22 20:08 bnmnetp

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?

rbeezer avatar Aug 22 '22 22:08 rbeezer

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.

bnmnetp avatar Aug 22 '22 22:08 bnmnetp

Right. I'll adjust in a bit.

rbeezer avatar Aug 22 '22 22:08 rbeezer

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.

rbeezer avatar Aug 23 '22 01:08 rbeezer

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 avatar Aug 23 '22 13:08 bnmnetp

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 avatar Aug 23 '22 15:08 bnmnetp

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

Screen Shot 2022-08-23 at 10 50 45 AM

bnmnetp avatar Aug 23 '22 15:08 bnmnetp

Better...

Screen Shot 2022-08-23 at 12 40 50 PM

bnmnetp avatar Aug 23 '22 17:08 bnmnetp

Looking good! ;-)

rbeezer avatar Aug 23 '22 17:08 rbeezer