Numbas

Development update: October 2020

I went from paternity leave in September straight into the mêlée of our first entirely online semester. Here’s an update of development work on Numbas during the month of October.

The vast majority of changes are bug fixes, now that so many more people are using Numbas and discovering edge cases. (And I made a couple of mistakes when introducing Numbas v5, sorry!)

Numbas runtime

I’ve tagged version 5.1 of the Numbas runtime on GitHub.

  • Enhancement: Exponentiation is defined for integer powers of rational numbers. (code)
  • Enhancement: Added a function rational(n) to convert a number data type to its closest rational approximation. (documentation)
  • Enhancement: The JME parser now supports chained relations, i.e. expressions like a < b < c. They’re rewritten to combinations of relations and and statements, such as (a<b) and (b<c). Thanks to Samuel Jemison for requesting this. (documentation)
  • Enhancement: The functions min and max now have separate implementations for each of the number-like types, so they’re much more accurate and return the same data type they’re given. (code)
  • Enhancement: Numbas.util.parseFraction now has a mustMatchAll option, so that it only accepts strings consisting solely of a valid fraction and no suffix. This resolves a problem where a number entry part would seem to accept an answer like 1/2 * 10^2. (code)
  • Enhancement: When defining a custom function in the editor, you can now specify the type of a list or dictionary’s contents, e.g. “list of number” or “dict of string”. Or, you can give an expression defining the signature of the argument. This makes it easier to write JavaScript functions without having to think about JME’s type-casting mechanisms. (documentation)
  • Enhancement: Packages downloaded from the editor now include a file downloaded-from.txt containing a URL that can be used to retrieve an up-to-date version of the package. (code)
  • Enhancement: A number of people asked for the ability to turn off the “print a transcript” button at the end of an exam. While I don’t think this offers much security, since students can take screenshots during their exam and you can turn off all feedback even when the exam is completed, I added an “allow students to print question content” option. (documentation)
  • Enhancement: The logic applied when splitting up strings of letters into single-letter variables now accounts for operations with lower precedence than multiplication. For example, xy^z is interpreted as x*(y^z), not (xy)^z. (issue)
  • Documentation: I’ve written some more detailed documentation on the syntax of JME expressions. (documentation)
  • Change: Numbas.jme.matchFunctionToArguments doesn’t look inside nested data structures that aren’t lists, so that it doesn’t return too specific an answer. (code)
  • Localisation: I updated the localisation files. Thanks to the many contributors who have translated the new strings introduced in Numbas v5.
  • Bugfix: Fixed a bug in Numbas.jme.variables.computeVariable when doing a partial remake of the variables. (code)
  • Bugfix: Ensure that the HTMLAttached question signal is only triggered once all the HTML is attached to the page, including parts. When I first fixed this on October 5th, I accidentally introduced a bug that was fixed on October 21st. (code)
  • Bugfix: The code to infer the type of a variable in a mathematical expression is now case-insensitive. (issue)
  • Bugfix: When the exam ends, make sure every question’s LaTeX is typeset. (issue)
  • Bugfix: Ensure that a custom part marking script written in JavaScript returns the right kind of object. (issue)
  • Bugfix: Every token produced by Numbas.jme.compile has a pos attribute giving its position in the source expression. (code)
  • Bugfix: Feedback for multiple choice part types follows the order of the choices as displayed, not the order in the editor. (issue)
  • Bugfix: gcd(0,a) = gcd(a,0) = abs(a). Thanks to Ulrich Goertz for spotting this. (issue)
  • Bugfix: Part labels are considered as display text, not plain text, so the TeX variable substitution rules apply. (issue)
  • Bugfix: The logic for the steps penalty was broken for gap-fills. The step penalty now applies proportionally to each gap. (issue)
  • Bugfix: Matrix entry parts no longer mark themselves as “unsubmitted” unnecessarily. (code)
  • Bugfix: The bracketing logic to do with complex numbers is more robust. (code)
  • Bugfix: When all the gaps in a gap-fill are worth 0 marks, each gap provides 1/(number of gaps) towards the part’s credit. (issue)

Extensions

  • New extension: I’ve written an extension “Download a text file” which makes it easy to generate a link which the student can click to download a file containing randomly-generated text. It’s also got a function to format data as a CSV file. (documentation)
  • Bugfix: The corrcoeff and covariance functions in the statistics extension are now correctly defined to take two lists of numbers. (code)

Editor

I’ve tagged version 5.1 of the Numbas editor on GitHub.

  • Enhancement: The theme and extension editors now instead of trying to display them as text, show images and display a link to download other binary files. There’s a form to replace any file in a theme or extensions with an uploaded file. There’s a form to upload a new file, too. (code)
  • Enhancement: I’ve staretd work on a “feature survey” tool which looks at the whole database to see how often particular features are used. This will help me to identify where I need to be more careful when making breaking changes. (issue)
  • Enhancement: Previews of exams and questions are now stored separately for each locale, and you can request a specific locale by adding a language parameter to the preview or embed URL. (issue)
  • Enhancement: You can search for projects in the top search bar – matching projects appear in the autocomplete dropdown. (issue)
  • Enhancement: If you call a custom function in the definition of a question variable and it returns a type other than the one it’s supposed to, the editor tries to suggest a change to the signature for the input parameters in case it’s a type-casting problem. For example, refine “list” to “list of number”. (issue)
  • Enhancement: When accessing the REST API as an authenticated user, it shows you all content visible to you, not just published content. At the moment, the mathcentre editor doesn’t offer token authentication so it’s of limited use, but I’d like to come back to this. (code)
  • Enhancement: The project members page shows all outstanding email invitations, and lets you cancel them. (issue)
  • Enhancement: Since there seem to be a few people running their own instances of the editor, I’ve added fixtures for the ability levels, subjects and topics available on the mathcentre editor, which are automatically loaded on installation. (code)
  • Change: The exam option “Show results page” has been renamed to “Reveal answers to all questions” to better describe what it now does. (code)
  • Bugfix: Before composing an email about a notification, check if the email is going to be sent. (code)
  • Bugfix: The “Upload extension” button now goes to the right form when you don’t have any extensions yet. (issue)
  • Bugfix: Fixed the display of the number of questions using an extension in the prompt to delete it. (code)
  • Bugfix: When creating an extension, write the right filename! (issue)
  • Bugfix: Fixed a lot of problems to do with editing themes. (issue)
  • Bugfix: When you transfer ownership of a project to someone else, you’re automatically given edit access to the project. (code)
  • Bugfix: You can’t use a forward slash in a folder’s name. (issue)
  • Bugfix: Project invitations are case-insensitive when matching email addresses. (code)
  • Bugfix: I think the item comparison view stopped working because of a change in Django. It’s working again. (code)
  • Bugfix: I wrote a tool to check all the help links shown in the editor, and made sure they all went to the right place. Thanks to Ulrich Görtz for bringing this to my attention. (issue)
  • Bugfix: The “Replace this part with a gap-fill” was broken for a bit. It’s working again. (issue)
  • Bugfix: Extension and theme packages are now extracted as part of the pre/post-save Django signals, rather than in the form logic. This means that packages uploaded through the Django admin interface are correctly extracted. (issue)

Numbas LTI provider

I’ve tagged v2.8 of the Numbas LTI provider on GitHub.

  • Enhancement: Numbas exam packages now include a file giving a URL from which to retrieve an up-to-date copy of the package. The LTI tool can use this to update its copy of a package without you having to go back to the editor and download it yourself. (code, documentation)
  • Enhancement: If you set the “available from” time for a resource later than the “available until” time, it’s interpreted as declaring that the resource should be unavailable between those times, but available before and after. (documentation)
  • Documentation: I’ve written some troubleshooting tips for when reporting scores doesn’t work. (documentation)
  • Bugfix: All remote requests now have a timeout limit set, so they won’t hang worker processes. Currently, fetching exam packages and reporting scores back to the consumer cause remote requests to be made. (issue)

Documentation

Numbas features full documentation which is always in line with the most recent version.

Numbas Documentation

Numbas Blog

We regularly update our blog with articles about new and future features, as well as other useful information.

Numbas Blog