Development log – September 2014

Here’s another round-up of the development work on Numbas in the past month-and-a-bit.

A little attribution

I’ve added a small attribution footer to the bottom of the default theme. It looks like this:

created using numbas

Now that people can upload their own themes, we wanted an unobtrusive way of noting that tests are built using Numbas. If you don’t want it there, you can use a modified theme to remove it, but we’d prefer you kept it.

Better error messages

I’ve spent some time looking at the ways Numbas tests can fail, with the aim of giving better information about what’s gone wrong. The biggest change is that errors encountered while the exam is loading now show a more helpful screen than the old pop-up message:

numbas die screen

And if you click on the error message, you get a JavaScript stack trace:

numbas die screen stack trace

I’ve worked on making the messages themselves more helpful, as well. Errors caused by a particular question will tell you which question they came from, so it’s easier to work out where to look. Numbas now catches a lot more errors encountered while resuming SCORM sessions – missing or mismatched data will cause an immediate error, instead of being ignored until it causes something else to fail. A common error is caused by variables not being defined – instead of cryptic messages like “no definition of ‘+’ of right type found” when one of the operands is an undefined variable, the error now says “Variable <name> not defined”.

Faster question search

The search page in the question editor is now a lot faster. Now that we have over 4,000 questions in the public database, it was taking a long time to filter the whole question set. I’ve rewritten the database queries so it takes just a few milliseconds to do the same thing.

Other changes

Here are the rest of the changes made to Numbas in the last month or so:

  • The ‘mode’ function in the stats extension always returns a list. Previously, if the sample only had one mode, it was returned as a simple number, but if there was more than one they’d be returned as a list. Now a single mode is returned as a list with one element. (code)
  • A couple of fixes to the new responsive theme to do with scrollbars – a vertical scrollbar the length of the whole exam no longer appears when printing in chrome (code), and horizontal scrollbars appear when the page content is too wide for the screen, for example a very wide table or long display-mode equation (code).
  • Extensions now wait until the JME system has loaded, so they can be given a Scope object to add functions to. (code)
  • abs(string) returns the length of the given string. (code)
  • Very small numbers are rendered correctly, instead of rounding off to 10 decimal places. (code)
  • Fixed a typo which meant that if only the “show current score” feedback option was ticked, the total score available was shown instead. (code)
  • If you resume an exam whose timer has run out, it ends immediately. (codeNote: the timer runs down even when the exam isn’t running. We didn’t think there was much point having a timer that you can pause by leaving the exam!
  • Fixed a bug to do with surplus whitespace in ruleset names. (code)
  • Fixed incorrect loading of variable definitions when the type is “range of numbers” or “random from a range”. (code)