Quiz questions of the multichoice type have stopped working.
I am getting this error:

Notice: Undefined variable: rows in include() (line 63 of /home/xxxxxxxxxxx/xxxxx.ca/sites/all/modules/quiz/question_types/multichoice/theme/multichoice-alternative.tpl.php).

I have about a hundred of these questions.
The True/False Questions are still fine.

When I view the question outside of the quiz, it looks like the screenshot.

Files: 

Comments

dadderley’s picture

So, I figured out why I was getting the error.
As it turned out, a lot of the multichoice questions that I created has uncaught errors with the text input format.

I created a whole bunch of multi-choice question nodes by cutting and pasting text from a D6 site. (There are usually 4 alternatives.)
So I created a whole pile of these and got no errors at all when saving the node.

Then I took the quiz and noticed the error.
I then noticed another error in the reports (referencing the multichoice questions)
Missing text format: <.

Looking at the multichoice question nodes. I see that for all of the alternatives and for the advanced options that the text input select box had lost its setting completely. Wen I created the nodes, the default text input format was set as full html.
Interestingly enough though, the Question text box had not lost this setting.
So, as a result all of the text that I had placed here with the text input format set as full html has been lost.
All that remains is "<".

The reason for this error:
Notice: Undefined variable: rows in include() (line 63 of /home/xxxxxxxxxxx/xxxxx.ca/sites/all/modules/quiz/question_types/multichoice/theme/multichoice-alternative.tpl.php).
Is that there were no answers (alternatives) for the questions to display because they had been screwed up by the text input format problem.

So now I have a whole bunch of questions that I have to recreate.
What the heck happened?

kenyan’s picture

Take heart, Quiz 7 has lots and more of bugs and you'll probably have to fix them yourself too.
Consider this particular issue queue as nothing but a scrap book.
Cheers

sivaji@knackforge.com’s picture

@dougzilla, I regret to hear to that. I have no idea as what could have caused the issue. If you wish to seek professional support, please reach me through d.o contact form.

dadderley’s picture

@sivaji Thanks for your interest.

Still not sure what precipitated the problem.
Here are things that I do know.

  • The multi-choice questions were spread across 3 quizzes.
  • All of the nodes were saved successfully, without errors and then were borked by some yet unknown factor
  • Not every one of multi-choice questions was affected - about 75% of them were.

Every multi-choice question that was borked had this in common:

  • Title was OK
  • All of the Question settings were intact
  • Question (Edit summary) field was OK - Text format stayed at the default Full HTML
  • All of the Values for the Correct checkbox were intact
  • All of the text in the Alternative text Areas was missing except for the a single "<"
  • All of the Text format settings for the Alternative text areas was reset to nothing (it had no setting at all). This is impossible to do manually.
  • All of the Text format settings for the "Advanced Options > Feedback if chosen" was reset to nothing (there was no text here before)
  • All of the Text format settings for the "Advanced Options > Feedback if not chosen" was reset to nothing (there was no text here before)

My gut feeling is that something really wacky happened in the revision tables.
It may have happened when I flushed the cache.
Before this happened I had not deleted any quiz revisions.
Now as I understand it a bit more, I can see how complicated these relationships are.

One other thing, when I am developing my quizzes I do a hell of a lot more testing and backing up now than I did before.
I have worked a lot with Quiz since early D6 releases. It is a great module.
I can hardly wait for it to stabilize for D7. I have a big project on the go right now and this module is integral to it.

sivaji@knackforge.com’s picture

Title:Problem with Multichoice question» Multichoice question option and feedback fields are reset on node_save() call
Version:7.x-4.0-alpha12» 7.x-4.x-dev
Status:Active» Fixed

I fixed this issues http://drupalcode.org/project/quiz.git/commit/77857df.

Cause: Save method in multichoice.classes.inc was receiving argument in different structure on node form submit and node_save() call.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bnobleman’s picture

This in turn breaks the other code which requires different structure. (see below error, when you try to edit a multichoice question).
The true solution is to fix the way node export formats the output. We used hook_node_export to workaround the problem, as we couldn't figure out what is responsible for format when exporting.

Error

Error message

Notice: Undefined index: answer_format in MultichoiceQuestion->updateAlternative() (line 263 of /home/apps/hitra7/sites/all/modules/quiz/question_types/multichoice/multichoice.classes.inc).
Notice: Undefined index: feedback_if_chosen_format in MultichoiceQuestion->updateAlternative() (line 265 of /home/apps/hitra7/sites/all/modules/quiz/question_types/multichoice/multichoice.classes.inc).
Notice: Undefined index: feedback_if_not_chosen_format in MultichoiceQuestion->updateAlternative() (line 267 of /home/apps/hitra7/sites/all/modules/quiz/question_types/multichoice/multichoice.classes.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'answer_format' cannot be null: UPDATE {quiz_multichoice_answers} SET answer=:db_update_placeholder_0, answer_format=:db_update_placeholder_1, feedback_if_chosen=:db_update_placeholder_2, feedback_if_chosen_format=:db_update_placeholder_3, feedback_if_not_chosen=:db_update_placeholder_4, feedback_if_not_chosen_format=:db_update_placeholder_5, score_if_chosen=:db_update_placeholder_6, score_if_not_chosen=:db_update_placeholder_7 WHERE (id = :db_condition_placeholder_0) AND (question_nid = :db_condition_placeholder_1) AND (question_vid = :db_condition_placeholder_2) ; Array ( [:db_update_placeholder_0] =>

Historical project practices to the designed projects to identify low points of performance and create motivations for improvements and to validate the basis by which to measure performance.

[:db_update_placeholder_1] => [:db_update_placeholder_2] => [:db_update_placeholder_3] => [:db_update_placeholder_4] => [:db_update_placeholder_5] => [:db_update_placeholder_6] => 0 [:db_update_placeholder_7] => 0 [:db_condition_placeholder_0] => 3439 [:db_condition_placeholder_1] => 741 [:db_condition_placeholder_2] => 1089 ) in MultichoiceQuestion->updateAlternative() (line 274 of /home/apps/hitra7/sites/all/modules/quiz/question_types/multichoice/multichoice.classes.inc).

sivaji@knackforge.com’s picture

Status:Closed (fixed)» Needs work

@bnobleman, thanks for the update. I will check that but it was not done for node export alone. see #2039743: MCQ can't be deleted!, without this patch, text format and options are set null/empty when updated using VBO and similar :(

  • Commit 77857df on 7.x-4.x, 7.x-5.x by sivaji:
    Fixed issue #1860448 - Multichoice question option and feedback fields...

  • Commit 77857df on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Fixed issue #1860448 - Multichoice question option and feedback fields...

  • Commit 77857df on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Fixed issue #1860448 - Multichoice question option and feedback fields...

  • Commit 77857df on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Fixed issue #1860448 - Multichoice question option and feedback fields...

  • sivaji committed 77857df on 7.x-6.x
    Fixed issue #1860448 - Multichoice question option and feedback fields...