Moodle
  1. Moodle
  2. MDL-8473 Numerical question: bugs and improvements
  3. MDL-8475

The new 1.8 interface does not handle well the delete of unused answers

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.7, 1.9.3
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      33291

      Description

      When you save a numerical answer the unused answers set to null remain with 0 as default and new ones are added.
      This can be solved by
      EITHER
      removing the line 30 of edit_numerical_form.php
      $mform->setType('answer', PARAM_NUMBER);
      because the 'answer' default to "0" when set as a param_number and the test line 117 of numerical/questiontype.php
      if ($dataanswer != '' || trim($question->feedback[$key])) {
      does not work.
      As the "0" default is a valid numerical answer removing the setType give a first partial solution.
      OR by handling the problem differently i.e.
      adding a new checkbox that explicitly ask for the delete an unused answer (line 28 of edit_numerical_form.php)
      $repeated[] =& $mform->createElement('checkbox', 'deleteanswer', get_string('delete this answer when saving question', 'qtype_numerical', '

      {no}

      '));
      and other lines in the validation process of edit_numerical_form.php and numerical/questiontype.php
      A solution has been worked for this option and the code will be made available after more complete testing.
      The validation process has also been extended to grade validation ( at least on 100% graded answer) as was reported by MDL-8094

        Issue Links

          Activity

          Hide
          Pierre Pichet added a comment -

          changing line 117 of numerical/questiontype.php
          if ($dataanswer != '' || trim($question->feedback[$key])) {
          to
          if (!isset( $question->deleteanswer[$key] ) && !( trim($dataanswer) == 0 && $question->fraction[$key]== 0 &&trim($question->feedback[$key])=='')) {
          clear all unused answers
          having answer= 0, the 0 being filld by the code given that $mform->setType('answer', PARAM_NUMBER);
          $question->fraction[$key]== 0 because fraction > 0 means that this is a valid answer
          feedback = nil which means that the 0 answer with 0 grade does not need additional comment
          the additional checkbox "delete this answer when saving question" is useful to delete an answer without having to set the naser, grade and feedback to o or nil and more evident for the user. Doing this in the saviong process is a more rapid way than having the regular submit.

          Show
          Pierre Pichet added a comment - changing line 117 of numerical/questiontype.php if ($dataanswer != '' || trim($question->feedback [$key] )) { to if (!isset( $question->deleteanswer [$key] ) && !( trim($dataanswer) == 0 && $question->fraction [$key] == 0 &&trim($question->feedback [$key] )=='')) { clear all unused answers having answer= 0, the 0 being filld by the code given that $mform->setType('answer', PARAM_NUMBER); $question->fraction [$key] == 0 because fraction > 0 means that this is a valid answer feedback = nil which means that the 0 answer with 0 grade does not need additional comment the additional checkbox "delete this answer when saving question" is useful to delete an answer without having to set the naser, grade and feedback to o or nil and more evident for the user. Doing this in the saviong process is a more rapid way than having the regular submit.
          Hide
          Pierre Pichet added a comment -

          After a discussion with Tim who think that we should not add an aditional element (additional checkbox "delete this answer when saving question" ) , I will CVS in the week-end a solution to 1.8 stable.
          Further development will be postponed to 1.9 and another sub-task will be created.

          Show
          Pierre Pichet added a comment - After a discussion with Tim who think that we should not add an aditional element (additional checkbox "delete this answer when saving question" ) , I will CVS in the week-end a solution to 1.8 stable. Further development will be postponed to 1.9 and another sub-task will be created.
          Hide
          Pierre Pichet added a comment -

          Test Ok.
          It does not store empty answer in the database so the answers are not growing and correctly erase them from the database if Answer is null , grade = No and feedback empty.

          Show
          Pierre Pichet added a comment - Test Ok. It does not store empty answer in the database so the answers are not growing and correctly erase them from the database if Answer is null , grade = No and feedback empty.
          Hide
          Pierre Pichet added a comment -

          Has been CVS to 18 STABLE and to HEAD

          Show
          Pierre Pichet added a comment - Has been CVS to 18 STABLE and to HEAD
          Hide
          Pierre Pichet added a comment -

          Trying to solve a problem on numerical question (email exchange with Jeff Forsell), I notice that the solution used need to be corrected.
          So I reopen it and will put it on the top of my todolist

          Show
          Pierre Pichet added a comment - Trying to solve a problem on numerical question (email exchange with Jeff Forsell), I notice that the solution used need to be corrected. So I reopen it and will put it on the top of my todolist
          Hide
          Pierre Pichet added a comment -

          The answers on Jeff Forssell system were not deleted because their feedback field contain invisible HTML tags
          <hints id="hah_hints"></hints><Unable to render embedded object: File (--/hints--><) not found.-/hints><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./hints><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./->
          <Unable to render embedded object: File (--/--><) not found.-/><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><Unable to render embedded object: File (--/--><) not found./><!/->
          Removing this from the feedback, the answers can be deleted.
          The code delete an answer if the answer and the feedback are null .

          However the time necessary to process the validation of the 12 answers and feedback was so large that there was a warning from the browsers (Firefox,Explorer) that a script was exceeding normal limits.
          The browsers offer to continue or stop the process.
          In one case the time exceeded the time limit of the Jeff Moodle server so the return was out moodle in the moodle/question directory.
          So there is no bug in the numerical question code.
          I will do some code cleaning before closing.

          Show
          Pierre Pichet added a comment - The answers on Jeff Forssell system were not deleted because their feedback field contain invisible HTML tags <hints id="hah_hints"></hints>< Unable to render embedded object: File (--/hints--><) not found. - /hints >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. /hints >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / -> < Unable to render embedded object: File (--/--><) not found. - / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / >< Unable to render embedded object: File (--/--><) not found. / ><! / -> Removing this from the feedback, the answers can be deleted. The code delete an answer if the answer and the feedback are null . However the time necessary to process the validation of the 12 answers and feedback was so large that there was a warning from the browsers (Firefox,Explorer) that a script was exceeding normal limits. The browsers offer to continue or stop the process. In one case the time exceeded the time limit of the Jeff Moodle server so the return was out moodle in the moodle/question directory. So there is no bug in the numerical question code. I will do some code cleaning before closing.
          Hide
          Jeff Forssell added a comment -

          Wow!
          I have seen <hints id="hah_hints"></hints> in my code sometimes, but never repeated with all those extra <!-/->.

          I think this:
          <hints id="hah_hints"></hints>
          is something that the FF plugin "Xinha Here" creates.

          This is a danger that have HTMLeditor boxes in places where it was there was just text boxes before- you can think something is empty that isn't!

          Show
          Jeff Forssell added a comment - Wow! I have seen <hints id="hah_hints"></hints> in my code sometimes, but never repeated with all those extra <!- / ->. I think this: <hints id="hah_hints"></hints> is something that the FF plugin "Xinha Here" creates. This is a danger that have HTMLeditor boxes in places where it was there was just text boxes before- you can think something is empty that isn't!
          Hide
          Pierre Pichet added a comment -

          The edit_numerical_form.php will be modified to detect the answer ='' and grade > 0 or feedback != ''
          and ask the user to put a valid number or * in the answer field.
          So the detection will not be done when saving the question options.

          Show
          Pierre Pichet added a comment - The edit_numerical_form.php will be modified to detect the answer ='' and grade > 0 or feedback != '' and ask the user to put a valid number or * in the answer field. So the detection will not be done when saving the question options.
          Hide
          Jeff Forssell added a comment -

          I've searched a bit more and it seems it may be another FF plugin that created <hints id="hah_hints"></hints> Hit-a-Hint see http://www.koders.com/javascript/fid92C7C9F4FFCD7A2348069D1D425F052B8731E8DE.aspx

          I'm trying out "mouseless browsing" plugin instead now.

          Show
          Jeff Forssell added a comment - I've searched a bit more and it seems it may be another FF plugin that created <hints id="hah_hints"></hints> Hit-a-Hint see http://www.koders.com/javascript/fid92C7C9F4FFCD7A2348069D1D425F052B8731E8DE.aspx I'm trying out "mouseless browsing" plugin instead now.
          Hide
          Pierre Pichet added a comment -

          The code also show the html coding of the feedback if the answer = ''.

          Show
          Pierre Pichet added a comment - The code also show the html coding of the feedback if the answer = ''.
          Hide
          Tim Hunt added a comment -

          I don't understand the line of code

          $errors["feedback[$key]"]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data['feedback'][$key]));

          It looks a bit like debug code to me, but I am not sure. For now I am going to remove it.

          Apart from that, good work. Getting this sort of thing right is always really fiddly, and and it looks like you nailed it. I tried my best to find a way to confuse it in testing, and I couldn't.

          Show
          Tim Hunt added a comment - I don't understand the line of code $errors["feedback [$key] "]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data ['feedback'] [$key] )); It looks a bit like debug code to me, but I am not sure. For now I am going to remove it. Apart from that, good work. Getting this sort of thing right is always really fiddly, and and it looks like you nailed it. I tried my best to find a way to confuse it in testing, and I couldn't.
          Hide
          Pierre Pichet added a comment -

          $errors["feedback[$key]"]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data['feedback'][$key]));
          The purpose of this line is to show the feedback HTML if it is not empty and answer is empty and grade == 0.
          If the answer feedback field is really empty, the answer will be deleted (answer =='' and grade==0) , if not the answer will stay.
          This is the problem encountered by Jeff Forssell, the HTML code in its feedback answers was invisible.
          This line shows the HTML feedback so the user is aware if it is not empty and can emtpy the feedback if he want the answer to be automatically deleted.
          So I will put it back.

          Show
          Pierre Pichet added a comment - $errors["feedback [$key] "]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data ['feedback'] [$key] )); The purpose of this line is to show the feedback HTML if it is not empty and answer is empty and grade == 0. If the answer feedback field is really empty, the answer will be deleted (answer =='' and grade==0) , if not the answer will stay. This is the problem encountered by Jeff Forssell, the HTML code in its feedback answers was invisible. This line shows the HTML feedback so the user is aware if it is not empty and can emtpy the feedback if he want the answer to be automatically deleted. So I will put it back.
          Hide
          Pierre Pichet added a comment -

          Tim
          I reopen it so you can put back the line
          $errors["feedback[$key]"]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data['feedback'][$key]));
          I cannot see in the history if you have done it actually.

          Show
          Pierre Pichet added a comment - Tim I reopen it so you can put back the line $errors["feedback [$key] "]=get_string('feedback','quiz').'='.htmlspecialchars(trim($data ['feedback'] [$key] )); I cannot see in the history if you have done it actually.
          Hide
          Tim Hunt added a comment -

          The problem is, that the feedback is not really a validation error, so it looks really bad to display it as such.

          Ah, perhaps a better idea is to change the validation code, so instead of doing

          if ... trim($question->feedback[$key])==''

          we do

          if ... trim(strip_tags($question->feedback[$key])) == ''

          That would ensure that the feedback is only saved if there is some real content there.

          The only case I can think of where that would fail is if the feedback comprised just an img tag, or something like that.

          Show
          Tim Hunt added a comment - The problem is, that the feedback is not really a validation error, so it looks really bad to display it as such. Ah, perhaps a better idea is to change the validation code, so instead of doing if ... trim($question->feedback [$key] )=='' we do if ... trim(strip_tags($question->feedback [$key] )) == '' That would ensure that the feedback is only saved if there is some real content there. The only case I can think of where that would fail is if the feedback comprised just an img tag, or something like that.
          Hide
          Tim Hunt added a comment -

          Ah, strip_tags has a second parameter, so we can not strip images for the test. Yay!

          Show
          Tim Hunt added a comment - Ah, strip_tags has a second parameter, so we can not strip images for the test. Yay!
          Hide
          Tim Hunt added a comment -

          Also, we should make sure the shortanswer question behaves in the same way.

          Show
          Tim Hunt added a comment - Also, we should make sure the shortanswer question behaves in the same way.
          Hide
          Pierre Pichet added a comment -

          However the test should be synchonized with the numerical/questiontype.php. (or shortanswer...)

          So we need to change the control line in numerical/questiontype.php
          if ( !( trim($dataanswer)=='' && $question->fraction[$key]== 0 && trim($question->feedback[$key])=='')) {
          to
          if ( !( trim($dataanswer)=='' && $question->fraction[$key]== 0 && trim(strip_tags($question->feedback[$key]))=='')) {

          Show
          Pierre Pichet added a comment - However the test should be synchonized with the numerical/questiontype.php. (or shortanswer...) So we need to change the control line in numerical/questiontype.php if ( !( trim($dataanswer)=='' && $question->fraction [$key] == 0 && trim($question->feedback [$key] )=='')) { to if ( !( trim($dataanswer)=='' && $question->fraction [$key] == 0 && trim(strip_tags($question->feedback [$key] ))=='')) {
          Hide
          Tim Hunt added a comment -

          Further fixes checked in. It would be great if you could do some additional testing Pierre, and thanks for your help with this.

          Show
          Tim Hunt added a comment - Further fixes checked in. It would be great if you could do some additional testing Pierre, and thanks for your help with this.
          Hide
          Tim Hunt added a comment -

          Since I had a hand in fixing this, it would be better if someone else QAed it.

          Show
          Tim Hunt added a comment - Since I had a hand in fixing this, it would be better if someone else QAed it.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: