Correct embedded short answers are marked incorrect

Correct embedded short answers are marked incorrect

by P H -
Number of replies: 20

Here are a couple of screenshots to illustrate the issue:

Moodle 3.10.1+ (Build: 20210226)

Average of ratings: -
In reply to P H

Re: Correct embedded short answers are marked incorrect

by Joseph Rézeau -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Hi P H (what a strange user name)

It's obviously impossible for us to answer your question from that screenshot. Please export and attach the XML file of that cloze question to your next post so we can examine it.

In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -
Thank you for your reply. How do I do that for a single quiz?
In reply to P H

Re: Correct embedded short answers are marked incorrect

by Joseph Rézeau -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Here's how...

  1. Go to the Question bank
  2. Edit your Cloze question
  3. Edit Question
  4. Preview
  5. Download this question in Moodle XML format
  6. Save File (to your computer)
  7. In your next post here, attach that .XML file

Joseph

Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -
In reply to P H

Re: Correct embedded short answers are marked incorrect

by Joseph Rézeau -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks for you reply with the attached question, "P H".

Found the culprit, a classical case of invisible newline break. I suppose you first typed your question in a word processor or text editor outside of Moodle and then did a copy-paste into the Moodle cloze question editor? Anyway, this is how I managed to find the problem.

  1. Using the Moodle Atto HTML editor (things might look slightly different if you are using the TinyMCE editor)
  2. Edit your cloze question
  3. Set the width of your Moodle window so that in the question editor you can see (approximately) the line of text ending with "conquer anyone".
  4. In the ATTO editor toolbar, click the Show More|Show/HideAdvanced button on the left hand side.
  5. In the second row of buttons which is now displayed, click the HTML button on the right hand side.
  6. In the HTML display you can clearly visualize the invisible line breaks. wide eyes
  7. The invisible line breaks inside the text of your question do not matter, but if there are line breaks inside the answers, this will break the answer analysis, and is the cause of your reported problem.
  8. Solution #1. While in the HTML display of the Moodle editor, you can quickly spot and remove one by one those offending line breaks inside your answer texts.
  9. Solution #2.
    1. A better solution is to close the HTML view (click the HTML button)
    2. Select and Copy the whole question text
    3. Click again the HTML view button
    4. In the HTML view, select everything and paste your previous selection, which will replace the current HTML contents, but without line breaks.
    5. I've attached your "cured" question.

Conclusion. To prevent such happenings, my recommendation is to never ever copy-paste question texts from a Word Processor/Text editor outside of Moodle into Moodle. Or, if you do, to always go into the HTML view to check for unwanted imported format tags. Some of those tags are easily detected, other, such as the infamous invisible line breaks are less so.

 

 

Average of ratings: Useful (3)
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -
Thank you very much for your help. I followed your instructions and sorted out the problem.

(Just for your information, I had copied the original text into notepad, added the SA codes and then copied and pasted the whole thing into my quiz question, which is what I normally do with no problem, so I am at a loss as why and what went wrong this time.)
Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -
I like my username actually... sad
In reply to P H

Re: Correct embedded short answers are marked incorrect

by Joseph Rézeau -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators
That's fine. On the Moodle forums we prefer to go by real names.wink
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
and real photos. smile
In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by Joseph Rézeau -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Dominique "... and real photos"

Is that a stone in my garden? wink My avatar was designed by my daughter Cali and I find it a much better visual representation of my inner self than any "real" photograph could achieve. Here's a link to another "digital painting" she made of me a few years ago.

Average of ratings: Useful (4)
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Joseph,

Nice to meet you. Your daughter is very talented.

smile
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Breathtaking!

What does that "cat pendulum" find, BTW? (Couldn't put the text in to a translator.)
In reply to Visvanath Ratnaweera

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers



Manufacturer's and merchants' copyrights: This clock is for sale on multiple websites.

In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

There is also the fact that the Atto editor "newlines" the text after about 255 characters when it is in <p> and <div> tags. That's okay if you stay in Moodle but as soon as you copy the code somewhere else, into any other editor, and then bring it back into Moodle, those new lines become hard line breaks and we have the OP's problem.

Newlining the text after 255 characters when it is in <p> and <div> tags may be a reminiscence of the past or a simple oversight, but can arguably be considered a bug of the Atto editor. Or maybe there is a good reason for this, which I don't know.

In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
In fact, it's worse than I expected.

Take the question from P H, which is a Cloze question containing many sub-questions, some of which are somewhat long but definitely not too long.

Edit the question with the Atto editor so that it works properly. Preview, fill in correct responses, and check that the question recognizes that all answers are correct. You will already have a hard time getting to this step.

If you get there, make a minor change to the question with the Atto editor. Visualize again and you will find the problem has returned.

The fact that the Atto editor inserts a new line in the text inside <p> and <div> tags after every 255 characters is definitely a nice bug. The problem it creates happens without even having to import the question from a text editor external to Moodle. In other words, the Atto editor by itself sabotages the Cloze question.

Now, you must convince yourself that it is a bug. This may be difficult. Eventually report it and wait for it to be fixed.

In the meantime, I recommend against using the Atto editor for this kind of Cloze question where the paragraphs containing the sub-questions are longer than 255 characters.

Instead, I recommend using the "Plain text area" editor.
In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
In fact, the text doesn't even have to be between <p> or <div> tags to be divided into blocks of 255 characters. Any text that is simply delimited by <br> tags will also be divided into blocks of 255 characters.

The good news is that the <span> tag prevents this behaviour. In other words, by surrounding the text in <span></span> tags, it doesn't get broken up.

So my answer to P H now is as follows. Reconnect the lines as indicated by Joseph and change the <p> tags to <span> tags. You also need to insert <br> tags between each paragraph delimited by the <span></span> tags. For example, you should modify your question like this:

...
<br>
<span>
    Text and sub-question(s).
</span>
<br>
<br>
<span>
    More text and sub-question(s).
</span>
<br>
...

If you don't change the <p> tags to <span> tags, the same problem will arise as soon as you edit your question.
Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello P H, Joseph and Visvanath,

I think that's it:   Short answer sub-question cut by Atto ↗

Tracker: Atto inserts a line break every 255 characters ↗
Average of ratings: Useful (3)
In reply to Dominique Bauer

Re: Correct embedded short answers are marked incorrect

by P H -
Thank you for following this up. Just voted for it.
Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -
Couldn't have put it better! My avatar tells you more about me than my face could ever do. And unfortunately, I don't have a talented daughter to bail me out.
In reply to Joseph Rézeau

Re: Correct embedded short answers are marked incorrect

by P H -

Well, I have always gone by my initials and I think I'll continue using them even if "we" may prefer otherwise.  wink

I can assure you though that I am real.

Average of ratings: Useful (1)