Capital vs lower case letters with units

Capital vs lower case letters with units

by Nikae Perkinson -
Number of replies: 8

Moodle 2.3

I teach an introductory chemistry course.  In the calculated question I have always had problems with units.

For example, Calories is a different unit than calories.  Likewise, mg is a different unit than Mg.

Moodle 2.3 does not allow me to differentiate between capital and lower case letters.  This is a problem.

Is there anyway I can address this?

Thanks!

Average of ratings: -
In reply to Nikae Perkinson

Re: Capital vs lower case letters with units

by Joshua Bragg -

I'm a chemistry teacher too and ran into the same issues.  Its actually better than you think.  

Its case sensitive from the student perspective but case-insensitive from the teacher perspective.

For example if you create a question with mL as the correct unit, Moodle will not allow you to add ml, ML, or Ml as additional units.  I just tried it on my 2.4 installation and it put in a general debug message.  I seem to remember that it used to do a "This is a duplicate" message in the editing form.

(@Tim Hunt: Is this a bug or by design?  It also made two incomplete questions in my question bank when I just retried this... When did this change?)

However, if you put in the unit as mL and a student types in the unit as ml, then they will receive a message that the unit is entered incorrectly.

So you can't enter alternate cases as options but students will be marked incorrect for alternate cases as well.  That has only caused me problems in a few instances.  I encourage my students to label all of their units in stoichiometry problems with the substance that they're using.  There are a few places where I've had to deal with "atoms S" (atoms of sulfur for the rest of you) that can cause problems if students enter it oddly.  The main issue on that one is that you have to choose between "atom S" and "atoms".  You can't have both. (Have you found the oddities with the spacing yet?)

I should really add some of this to the Docs...

Average of ratings: Useful (4)
In reply to Joshua Bragg

Re: Capital vs lower case letters with units

by Nikae Perkinson -

Thanks for your input - I'm trying to find a way to hammer in the importance of units in dimensional analysis without having to spend hours grading the quizzes.  

 So does the capital vs lower case differentiation only work for units that aren't words?

A student entered "Calories" as an answer when "calories" was the correct unit.   The answer was marked as correct.

Hmmm, writing what is being measured.  That makes sense in stoichiometry, but in previous quizzes I got tired of writing 12 different units (g of H2O, grams of H2O, g H2O, grams H2O, each with different numbers of spaces between each word or symbol) to catch all the different ways that students might write the answer.  These are intro to chem (pre-college level) students, so things can get creative.

Thanks for the head's up on sulfur.  I'll steer clear of atoms S. 

I haven't run into any spacing oddities yet, which is a nice change.

Thanks again for your response, it gives me a clarity about how to adjust the questions.

 

In reply to Nikae Perkinson

Re: Capital vs lower case letters with units

by Joshua Bragg -

The Calories vs calories problem is going to be an issue that can't be solved with Moodle in its current state.

I haven't had to think this through since I first started off with Moodle and knew little about the community and Moodle structure.  As such I never looked in the tracker for it and I just figured out how to make it work.   It turns out this is a bug caused by MySQL database collation selection.  (MDL-22117)

Sadly, after reading through the attached issues and Dev docs, and seeing your earlier post about being in a community college, I don't think its likely to be something that is easily fixed on your end.  (I teach high school in Winston-Salem BTW).

Yeah, writing the many different units does get really old.  Being a high school teacher, I have more time to train them on exactly what I want them to put in than you do.

The spacing oddities are another bug that I just learned to work around before I knew about all of this (MDL-20765).  Here is what I figured out.  If there is a space in a possible unit in the question editing page then it will be impossible to match that unit.  This is because Moodle has to deal with "2g" and "2 g" and mark them both correctly.  So it seems to strip out all spaces in the student answers.  Then when it compares the unit to the saved unit, they don't match because they're missing the spaces.

So if you want to get "2 g of H2O" graded correctly you have to put the unit in the question as "gofH2O".

Average of ratings: Useful (3)
In reply to Joshua Bragg

Re: Capital vs lower case letters with units

by Nikae Perkinson -

Aaah.  Many, many thanks.  This will save me hours and hours.

In reply to Joshua Bragg

Re: Capital vs lower case letters with units

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is a bug with the MySQL database. It consideres 'x' to equal 'X' by default, and there is nothing Moodle can do the work around this.

You can fix this by trying one of these things:

1. Use a better database like Postgres.

2. Change the collation on the question_numerical_units table from utf8_..._ci to utf8_bin.

http://docs.moodle.org/dev/Database_collation_issue describes the problem in more details. It also affects calculated qtype variable names.

Average of ratings: Useful (2)
In reply to Joshua Bragg

Re: Capital vs lower case letters with units

by Tim Vaughn -

I am running Moodle 2.5.5. I had a numerical question with units.  The units were "Watts". I wanted the students to get it correct whether they entered "watts" or "Watts".

Moodle will mark "watts" wrong with lower case "w", but it does not allow me to add the unit "watts". When I attempt to add units with same spelling but different case I get the error "Error writing to database".  Apparently the MySQL database cannot differentiate between upper or lower case, but it stores the entries with whatever case you put it.  Then Moodle does compare the case and marks it wrong, even if you want to ignore the case on the unit.

This is not so nice for subjects like engineering, math, chemistry and physics where case may be important.

In reply to Tim Vaughn

Re: Capital vs lower case letters with units

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You are correct. MySQL cannot tell the difference between 'w' and 'W', at least not with the default configuration. The key part of the configuration is the collation. If you can change the collation of the column mdl_question_numerical_units.unit to utf8_bin, things should start working. There is a tracker issue for this. See http://docs.moodle.org/dev/Database_collation_issue.