Moodle
  1. Moodle
  2. MDL-31828

Student can't submit if the essay question type is in the quiz (2.2)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Quiz
    • Labels:
    • Environment:
      Moodle 2.2, Oracle
    • Database:
      Oracle
    • Testing Instructions:
      Hide

      This bug needs to be tested on Oracle, but it would be good to repeat the tests on a more common database (that is, MySQL) to verify there are no regressions their either.

      1. Create a quiz and add two essay questions.
      2. The first essay question should allow attachments.
      3. The second essay question should use the HTML editor with the filepicker.
      4. Attempt the quiz as a student.
      5. Attach a file to the first essay question.
      6. Embed an image into your answer for the second question.
      7. Submit the quiz.
      8. As either teacher or student, review the quiz, and make sure the files are all present and correct.
      9. Finally, for good measure, as teacher regrade the quiz (using the button in the Results -> Grades report in the quiz navigation). Make sure the files are still present.

      Show
      This bug needs to be tested on Oracle, but it would be good to repeat the tests on a more common database (that is, MySQL) to verify there are no regressions their either. 1. Create a quiz and add two essay questions. 2. The first essay question should allow attachments. 3. The second essay question should use the HTML editor with the filepicker. 4. Attempt the quiz as a student. 5. Attach a file to the first essay question. 6. Embed an image into your answer for the second question. 7. Submit the quiz. 8. As either teacher or student, review the quiz, and make sure the files are all present and correct. 9. Finally, for good measure, as teacher regrade the quiz (using the button in the Results -> Grades report in the quiz navigation). Make sure the files are still present.
    • Workaround:
      Hide

      After I reviewed the source code carefully, I found line 154 in question/engine/datablib.php, "$value->save_files($stepid, $context)" should return the value. So, just simple change the line to:

      line 154: $value = $value->save_files($stepid, $context);

      Things work as expected. I am not sure this only happens to Oracle or also to other databases.

      Show
      After I reviewed the source code carefully, I found line 154 in question/engine/datablib.php, "$value->save_files($stepid, $context)" should return the value. So, just simple change the line to: line 154: $value = $value->save_files($stepid, $context); Things work as expected. I am not sure this only happens to Oracle or also to other databases.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      38467

      Description

      Student cannot submit the essay question after inputting something or attaching a file. After clicking the "Next" button, got the following ORA message: ORA-24343: user defined callback error.

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          This is basically the same problem as MDL-29339.

          Your suggested fix in the work-around is wrong. save_files does not return anything, so with your change the wrong value (NULL) will be inserted into the database.

          I think a correct fix is to add one line after the $save files line, so the code looks like

                      if ($value instanceof question_file_saver) {
                          $value->save_files($stepid, $context);
                          $value = (string) $value;
                      }
          

          Please can you test this. Preferably test this on the latest 2.2.1+ version.

          Show
          Tim Hunt added a comment - This is basically the same problem as MDL-29339 . Your suggested fix in the work-around is wrong. save_files does not return anything, so with your change the wrong value (NULL) will be inserted into the database. I think a correct fix is to add one line after the $save files line, so the code looks like if ($value instanceof question_file_saver) { $value->save_files($stepid, $context); $value = (string) $value; } Please can you test this. Preferably test this on the latest 2.2.1+ version.
          Hide
          Longfei Yu added a comment -

          I tested your suggestion, works great.

          Yes, for my workaround, I found the (NULL) for the "attachment" , and I think you are right. However, from the front end, students/teachers see everything correctly, they still can download the attachments.

          Anyway, you think this problem only happens to "Essay" question type, does it effect any other types of questions? We are in the middle of testing and evaluating the 2.2, and hopefully everything will be going well, so that we will be able to put it for Production for FALL.

          I tested on "$release = '2.2.1+ (Build: 20120202)';"

          Thanks.

          Show
          Longfei Yu added a comment - I tested your suggestion, works great. Yes, for my workaround, I found the (NULL) for the "attachment" , and I think you are right. However, from the front end, students/teachers see everything correctly, they still can download the attachments. Anyway, you think this problem only happens to "Essay" question type, does it effect any other types of questions? We are in the middle of testing and evaluating the 2.2, and hopefully everything will be going well, so that we will be able to put it for Production for FALL. I tested on "$release = '2.2.1+ (Build: 20120202)';" Thanks.
          Hide
          Tim Hunt added a comment -

          The difference between my code and your code is very subtle. It is to do with the compare_responses method.

          This issue only affects question with attachemnts - so only essay at the moment.

          I will try to get this fix committed tomorrow, which means it should be in Moodle 2.2.2 in a few weeks time.

          Show
          Tim Hunt added a comment - The difference between my code and your code is very subtle. It is to do with the compare_responses method. This issue only affects question with attachemnts - so only essay at the moment. I will try to get this fix committed tomorrow, which means it should be in Moodle 2.2.2 in a few weeks time.
          Hide
          Tim Hunt added a comment -

          Sorry, I forgot to say: Thank you for testing this so quickly.

          Show
          Tim Hunt added a comment - Sorry, I forgot to say: Thank you for testing this so quickly.
          Hide
          Longfei Yu added a comment -

          Thanks a lot! Last question, you think this issue only happens to Oracle? Or nothing to do with the database types?

          Show
          Longfei Yu added a comment - Thanks a lot! Last question, you think this issue only happens to Oracle? Or nothing to do with the database types?
          Hide
          Tim Hunt added a comment -

          It is Oracle only, like the other issues I linked to. (Which is why no-one else has reported it yet.)

          Show
          Tim Hunt added a comment - It is Oracle only, like the other issues I linked to. (Which is why no-one else has reported it yet.)
          Hide
          Sam Hemelryk added a comment -

          Thanks Tim, this has been integrated and is up for testing now (noting that you have already tested thanks Longfei)

          Show
          Sam Hemelryk added a comment - Thanks Tim, this has been integrated and is up for testing now (noting that you have already tested thanks Longfei)
          Hide
          Dan Poltawski added a comment -

          Assigning myself as tester as I have access to oracle setup

          Show
          Dan Poltawski added a comment - Assigning myself as tester as I have access to oracle setup
          Hide
          Rajesh Taneja added a comment -

          Works Good on Mysql and postgres. Have requested Dan P, to test on oracle.

          Thanks for fixing this Tim.

          Show
          Rajesh Taneja added a comment - Works Good on Mysql and postgres. Have requested Dan P, to test on oracle. Thanks for fixing this Tim.
          Hide
          Dan Poltawski added a comment -

          Verified the problem and solution on oracle and works as expected.

          Also verified test instrictions on mysql . Passing thanks!

          Show
          Dan Poltawski added a comment - Verified the problem and solution on oracle and works as expected. Also verified test instrictions on mysql . Passing thanks!
          Hide
          Dan Poltawski added a comment -

          Argh sorry, pressed wrong button

          Show
          Dan Poltawski added a comment - Argh sorry, pressed wrong button
          Hide
          Michael de Raadt added a comment -

          Reset testing.

          Show
          Michael de Raadt added a comment - Reset testing.
          Hide
          Dan Poltawski added a comment -

          Passed.. sorry for the noise!

          Show
          Dan Poltawski added a comment - Passed.. sorry for the noise!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!).

          icao_reverse('arreis olik rebemevon afla letoh ognat');
          

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!). icao_reverse('arreis olik rebemevon afla letoh ognat'); Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: