Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29294

Restore of match question type fails

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.12
    • Fix Version/s: 1.9.17
    • Component/s: Questions
    • Labels:
    • Environment:
      Solaris + Oracle
    • Database:
      Oracle
    • Testing Instructions:
      Hide

      Import activities to a course with match questions (we attach you the one that we've used).

      This needs to be tested on Oracle (which the original reporter has already done) and one other DB (e.g. Postgres, which I have done).

      Show
      Import activities to a course with match questions (we attach you the one that we've used). This needs to be tested on Oracle (which the original reporter has already done) and one other DB (e.g. Postgres, which I have done).
    • Workaround:
      Hide

      At the moment, to fix the problem we have replaced the line 576 in the question/type/match/questiontype.php:

      $db_match_sub = get_record ("question_match_sub","question",$new_question_id,
      "questiontext",$match_sub->questiontext,
      "answertext",$match_sub->answertext);

      for the following source:
      -----------------------------------
      global $CFG;
      $questiontextfield = 'questiontext';
      if ($CFG->dbfamily == 'oracle'){
      $questiontextfield = 'TO_CHAR('.$questiontextfield.')';
      }
      $db_match_sub = get_record ("question_match_sub","question",$new_question_id,
      $questiontextfield,$match_sub->questiontext,
      "answertext",$match_sub->answertext);
      -----------------------------------------

      Is not the better solution but, at the moment, it works

      Show
      At the moment, to fix the problem we have replaced the line 576 in the question/type/match/questiontype.php: $db_match_sub = get_record ("question_match_sub","question",$new_question_id, "questiontext",$match_sub->questiontext, "answertext",$match_sub->answertext); for the following source: ----------------------------------- global $CFG; $questiontextfield = 'questiontext'; if ($CFG->dbfamily == 'oracle'){ $questiontextfield = 'TO_CHAR('.$questiontextfield.')'; } $db_match_sub = get_record ("question_match_sub","question",$new_question_id, $questiontextfield,$match_sub->questiontext, "answertext",$match_sub->answertext); ----------------------------------------- Is not the better solution but, at the moment, it works
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Pull from Repository:

      Description

      When we try to import quizzes in a course and it has some match question, the restore process fails. When we activate the debug option the following error is showed:

      ORA-00932: inconsistent datatypes: expected - got CLOB

      SELECT * FROM mlquestion_match_sub WHERE question = '4768' AND questiontext = 'Nicotina' AND answertext = 'Crea addicció'
      line 686 of lib/dmllib.php: call to debugging()
      line 481 of lib/dmllib.php: call to get_recordset_sql()
      line 421 of lib/dmllib.php: call to get_record_sql()
      line 576 of question/type/match/questiontype.php: call to get_record()
      line 484 of question/restorelib.php: call to question_match_qtype->restore_map()
      line 217 of question/restorelib.php: call to restore_questions()
      line 134 of question/restorelib.php: call to restore_question_category()
      line 3573 of backup/restorelib.php: call to restore_question_categories()
      line 8599 of backup/restorelib.php: call to restore_create_questions()
      line 66 of backup/restore_execute.html: call to restore_execute()
      line 170 of backup/restore.php: call to include_once()

        Gliffy Diagrams

          Activity

          Hide
          timhunt Tim Hunt added a comment -

          There must be a sql_compare_text missing from one of the queries.

          Show
          timhunt Tim Hunt added a comment - There must be a sql_compare_text missing from one of the queries.
          Hide
          timhunt Tim Hunt added a comment -

          We no longer support 1.9, so this fix may never be committed, but based on the above suggestion, I made a proper fix.

          If someone can test this, then I will submit it for integration.

          Show
          timhunt Tim Hunt added a comment - We no longer support 1.9, so this fix may never be committed, but based on the above suggestion, I made a proper fix. If someone can test this, then I will submit it for integration.
          Hide
          timhunt Tim Hunt added a comment -

          Also attaching the fix as a patch that can be applied with git am

          Show
          timhunt Tim Hunt added a comment - Also attaching the fix as a patch that can be applied with git am
          Hide
          timhunt Tim Hunt added a comment -

          Is anyone up for testing this? If not, I will have to just close this bug. I cannot test it myself.

          Show
          timhunt Tim Hunt added a comment - Is anyone up for testing this? If not, I will have to just close this bug. I cannot test it myself.
          Hide
          sarjona Sara Arjona added a comment -

          Sorry for the delay! We confirm you that the patch works correctly so you could submit it for integration whenever you want.

          Show
          sarjona Sara Arjona added a comment - Sorry for the delay! We confirm you that the patch works correctly so you could submit it for integration whenever you want.
          Hide
          timhunt Tim Hunt added a comment -

          Thanks for testing this, I am submitting it for integration now.

          Show
          timhunt Tim Hunt added a comment - Thanks for testing this, I am submitting it for integration now.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          The integration of this issue has been delayed to next week because the integration period is over (Monday, Tuesday) and testing must happen on Wednesday.

          This change to a more rigid timeframe on each integration/testing cycle aims to produce a better and clear separation and organization of tasks for everybody.

          This is a bulk-automated message, so if you want to blame somebody/thing/where, don't do it here (use git instead) :-D :-P

          Apologizes for the inconvenient, this will be integrated next week. Thanks for your collaboration & ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - The integration of this issue has been delayed to next week because the integration period is over (Monday, Tuesday) and testing must happen on Wednesday. This change to a more rigid timeframe on each integration/testing cycle aims to produce a better and clear separation and organization of tasks for everybody. This is a bulk-automated message, so if you want to blame somebody/thing/where, don't do it here (use git instead) :-D :-P Apologizes for the inconvenient, this will be integrated next week. Thanks for your collaboration & ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Note that 1.9.x series are really out from support and this has been integrated just because the change was trivial and has been tested (by you and again by me under the 4 databases).

          I't highly recommendable to upgrade to the 2.x series of Moodle ASAP.

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks! Note that 1.9.x series are really out from support and this has been integrated just because the change was trivial and has been tested (by you and again by me under the 4 databases). I't highly recommendable to upgrade to the 2.x series of Moodle ASAP. Ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Passes tests.

          I've debugged the offending query by restoring the attached course twice under the 4 databases and it has worked as expected.

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Passes tests. I've debugged the offending query by restoring the attached course twice under the 4 databases and it has worked as expected.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          This virus has been spread upstream, everybody will be infected soon. Congrats, you did it!

          Closing, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - This virus has been spread upstream, everybody will be infected soon. Congrats, you did it! Closing, ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Mar/12