When I start the quiz the cloze question is not displayed. When I have finished the quiz, the question is displayed in the results.

Comments

sivaji_ganesh_jojodae’s picture

Yes! I have seen this bug too :)

Whylk’s picture

Any chance of getting this bug fixed in the nearby future? Would be great if possible.

antoinetooley’s picture

I have this problem too.

get these error messages when trying to see the question:
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'p' in _cloze_get_question_chunks() (line 106
Notice: Undefined index: und in ClozeQuestion->getAnsweringForm() (line 162
get these errors at the end when it shows the question in the results:
Notice: Undefined index: und in ClozeQuestion->evaluateAnswer() (line 248
Notice: Undefined property: stdClass::$body in ClozeQuestion->evaluateAnswer() (line 248
Notice: Undefined index: und in ClozeResponse->getReportFormResponse() (line 420

Hope that might help a little.
looks like an awesome addition to quiz though would love to see this working!

antoinetooley’s picture

is there any update with this problem? this module has great potential!!

sivaji_ganesh_jojodae’s picture

Status: Active » Postponed (maintainer needs more info)

Now I couldn't reproduce this bug. Looks like this is fixed due to recent change made in quiz.module regarding revisionising. I will revisit this issue if there is specific steps to reproduce this bug.

antoinetooley’s picture

Using drupal 7, quiz version 4.x dev and Cloze 1.x dev I am still getting these some errors with the questions not displaying until the results page. What version of quiz are you using? thanks

sivaji_ganesh_jojodae’s picture

I'm using the same version here. Please share the steps to reproduce if you could.

antoinetooley’s picture

ahh I just tried a fresh install on my local host and it works! guess i need to uninstall quiz and and cloze and reinstall then hopefully it will all work on my main site. Thanks for an awesome module ive been really excited to try this for a while now!

alex_21’s picture

I confirm, but just disable and re enable the cloze module worked for me. Hope it will be useful for someone else.

stewest’s picture

We think we have found the error. Line 106 of the cloze.module

If you have html characters in the Question body, it causes the error. A possible solution is, for instance, to change line 106 '/' to '|'. But we believe that by setting the input format in the body, as a temporary measure also solves the problem.

function _cloze_get_question_chunks($question) {
  $chunks = array();
  while (strlen($question) > 0) {
    $match = FALSE;
    $pos = strpos($question, '[');
    if ($pos) {
      $substring = substr($question, 0, $pos);
// Change here  
     $question = preg_replace('|'. preg_quote($substring) .'|', '', $question, 1);
      $chunks[] = $substring;
      $match = TRUE;
    }
    $pos = strpos($question, ']');
    if ($pos !== FALSE) {
      $substring = substr($question, 0, $pos + 1);
// Change here 
      $question = preg_replace('|'. preg_quote($substring) .'|', '', $question, 1);
      $chunks[] = $substring;
      $match = TRUE;
    }
    if (!$match) {
      $chunks[] = $question;
      $question = '';
    }
  }
  return $chunks;
}
kimberleycgm’s picture

Issue summary: View changes
StatusFileSize
new4.27 KB

I know this is a very old issue - but in case anyone else is still finding this. The cause of this on our site was having multilingual enabled on the body field. The module only looks for LANGUAGE_NONE and therefore didn't display any data. I've attached a quick patch just replacing all instances of LANGUAGE_NONE with the current language. Not tested extensively yet, but seems to work so far.

kimberleycgm’s picture

Status: Postponed (maintainer needs more info) » Needs review
avpaderno’s picture

Title: Cloze question not displayed » Question is not displayed
Status: Needs review » Active