-
Bug
-
Resolution: Fixed
-
Minor
-
3.11.12, 4.0.6, 4.1.1
-
MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
-
MOODLE_400_STABLE, MOODLE_401_STABLE
-
MOODLE_401_STABLE
-
master
-
A student copied text into a essay type question in a quiz which had a word limit of 200 words. The text they copied had a word count of 196 from word and the wc command, but the count_words() function was counting it as 202 words. See the attached image from the quiz.
The discrepancy was due to moodle storing lots of spans in the text, and as the count_word function adds a space after tags that are not obviously inline, as a result two single words were split and full stops were considered to be words.
The fix is to add:
span> |
|
to the list of tags that are considered to be inline, on line 8394 of lib/moodlelib.php:
https://github.com/fcbsd/moodle/commit/62c81ec024860a63d75190e9b938885a3eebedc8
following this change the count_words correctly identifies that the text has 196 words.
The attached html file is a copy of the div from the moodle quiz where the text was entered.
I have also added a test case for this issue:
https://github.com/moodle/moodle/compare/master...fcbsd:moodle:MDL-77365
I have also tested that this bug exists in https://sandbox.moodledemo.net/
- has been marked as being related by
-
MOBILE-4276 Inaccurate word count in the app (MDL-77365)
- Closed