Problem with calculated question

Problem with calculated question

by Luis Vázquez de Lara -
Number of replies: 6

Hi,

I use calculated questions with shared wildcards, and when trying to edit one of them the following warning appears:

Standards: Creating default object from empty value in /usr/share/moodle/question/type/calculated/questiontype.php on line 1637


When I finish editing the first page and click save, then the following appears:

Strict Standards: Creating default object from empty value in /usr/share/moodle/question/type/calculated/questiontype.php on line 1637.


I click on "continue",  then the wildcard dataset propertieas page appears, I click on continue and then appears:

db->get_record() found more than one record!

  • line 1358 of /lib/dml/moodle_database.php: call to debugging()
  • line 1318 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
  • line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
  • line 1051 of /question/type/calculated/questiontype.php: call to moodle_database->get_record()
  • line 402 of /question/type/calculated/datasetitems_form.php: call to qtype_calculated->comment_on_datasetitems()
  • line 221 of /question/question.php: call to question_dataset_dependent_items_form->set_data()

This appears 4 times (I have 4 datasets in this question), and below this, the "edit the wildcard datasets" page appears. I work on this page and when saving it appears again:

Error: mdb->get_record() found more than one record!

  • line 1358 of /lib/dml/moodle_database.php: call to debugging()
  • line 1318 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
  • line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
  • line 1051 of /question/type/calculated/questiontype.php: call to moodle_database->get_record()
  • line 402 of /question/type/calculated/datasetitems_form.php: call to qtype_calculated->comment_on_datasetitems()
  • line 221 of /question/question.php: call to question_dataset_dependent_items_form->set_data()

 

This appears 6 times. Although I can save the changes, and the question seem to perform well, I don't know if this can be an issue in the future.

Thanks 

Luis

Average of ratings: -
In reply to Luis Vázquez de Lara

Re: Problem with calculated question

by Pierre Pichet -

This appears as a bug that should be corrected.

New coding standards have been applied but all the code has not been completely tested as we can conlude sad.

If not already done, I will create a bug related to this problem.

Thanks,

Pierre

 

In reply to Pierre Pichet

Re: Problem with calculated question

by Pierre Pichet -

The message related to line 1637 is easily solved by defining the parameter as  new stdClass();

The db->get_record() double record needs more investigation.

The bug will be set when the problem will be more clearly identified.

Pierre

In reply to Luis Vázquez de Lara

Re: Problem with calculated question

by Pierre Pichet -

Hi Luis,

The second error is related to the fact that you have more than one unit with value 1.

The code should be modifed to handle this.

 

 

Pierre

In reply to Pierre Pichet

Re: Problem with calculated question

by Luis Vázquez de Lara -

Hi Pierre,

Thanks for your response. I'll wait for the bug to be fixed.

Best regards

Luis