Moodle

check for space in units

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.7, 2.0
  • Fix Version/s: None
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Activity

Hide
Roger Moore added a comment -

Problem needs fixing urgently: an instructor who adds spaces accidentally at the end of the unit field produces an error that is exceedingly hard to catch. This can negatively impact on the perception of Moodle since it makes it appear that Moodle is simply getting things wrong and does not work at simple tasks. This also affects 2.0 even with the separate unit entry field.

For example if metres is accidentally entered as "m " in the question editor then all students entering a response of "<correct value>m" will get it graded as wrong, even if they add the space since the space is stripped from the students response.

SUGGESTED FIX:
Strip trailing spaces from the instructor entered units in the form. Not sure about MOODLE 2.0 (where the problem still exists) but a call to 'trim()' in the form parsing code in question/type/<typename>/questiontype.php should be a quick fix for the very hard to catch trailing space issue.

Show
Roger Moore added a comment - Problem needs fixing urgently: an instructor who adds spaces accidentally at the end of the unit field produces an error that is exceedingly hard to catch. This can negatively impact on the perception of Moodle since it makes it appear that Moodle is simply getting things wrong and does not work at simple tasks. This also affects 2.0 even with the separate unit entry field. For example if metres is accidentally entered as "m " in the question editor then all students entering a response of "<correct value>m" will get it graded as wrong, even if they add the space since the space is stripped from the students response. SUGGESTED FIX: Strip trailing spaces from the instructor entered units in the form. Not sure about MOODLE 2.0 (where the problem still exists) but a call to 'trim()' in the form parsing code in question/type/<typename>/questiontype.php should be a quick fix for the very hard to catch trailing space issue.
Hide
Patrick Thibaudeau added a comment -

I fixed this issue for Moodle 2.x

Here is the change I made:

In moodle root/question/type/numerical/questiontype.php line 334

original : $units[$i]>unit = $question>unit[$i];

fix : $units[$i]>unit = trim($question>unit[$i]);

Could you please add this fix to the Moodle core.

Thank you

Show
Patrick Thibaudeau added a comment - I fixed this issue for Moodle 2.x Here is the change I made: In moodle root/question/type/numerical/questiontype.php line 334 original : $units[$i]>unit = $question>unit[$i]; fix : $units[$i]>unit = trim($question>unit[$i]); Could you please add this fix to the Moodle core. Thank you
Hide
Pierre Pichet added a comment -

Thanks for reminding me this problem that I effectively forgot in building 2,0 code.

Show
Pierre Pichet added a comment - Thanks for reminding me this problem that I effectively forgot in building 2,0 code.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: