Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.10, 2.3.6, 2.4.2, 2.5
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      Before applying the solution
      Create a calculatedsimple question, save it
      Edit the question and make a copy.
      If you preview the second question there a message of double record although the question seems OK

      If you look at the question_dataset_definitions there should be double records.
      After doing the modification

      If you preview the second question there should be no message of double record.
      If you look at the question_dataset_definitions there should be no double records.

      Show
      Before applying the solution Create a calculatedsimple question, save it Edit the question and make a copy. If you preview the second question there a message of double record although the question seems OK If you look at the question_dataset_definitions there should be double records. After doing the modification If you preview the second question there should be no message of double record. If you look at the question_dataset_definitions there should be no double records.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      When saving as new a calculatedsimple question the datasets are copy twice leading to double records.

        Gliffy Diagrams

          Activity

          Hide
          ppichet Pierre Pichet added a comment - - edited

          In calculatedsimple all the question data including the datasets are on the form so we should be able
          to save the question as a regular one.

          In calculated the code begin by

           
          public function save_question($question, $form) {
                  global $DB;
                  if ($this->wizardpagesnumber() == 1) {
                          $question = parent::save_question($question, $form);
                      return $question;
                  }
          

          replacing

          if ($this->wizardpagesnumber() == 1)

          by

          ($this->wizardpagesnumber() == 1 || $question->qtype == 'calculatedsimple')

          On testing with echo $this->wizardpagesnumber() return 3 which is the value for calculated ???

          This solve the problem as verify when looking at database after a "Make copy" of an existing question.

          This affect all versions 2.0 ...

          Show
          ppichet Pierre Pichet added a comment - - edited In calculatedsimple all the question data including the datasets are on the form so we should be able to save the question as a regular one. In calculated the code begin by public function save_question($question, $form) { global $DB; if ($this->wizardpagesnumber() == 1) { $question = parent::save_question($question, $form); return $question; } replacing if ($this->wizardpagesnumber() == 1) by ($this->wizardpagesnumber() == 1 || $question->qtype == 'calculatedsimple') On testing with echo $this->wizardpagesnumber() return 3 which is the value for calculated ??? This solve the problem as verify when looking at database after a "Make copy" of an existing question. This affect all versions 2.0 ...
          Hide
          timhunt Tim Hunt added a comment -

          That looks good. Please can you create branches for the 23 and 24 stabler branches, then we can submit this for integration.

          Show
          timhunt Tim Hunt added a comment - That looks good. Please can you create branches for the 23 and 24 stabler branches, then we can submit this for integration.
          Hide
          ppichet Pierre Pichet added a comment -

          This should be done in the weekend.

          Show
          ppichet Pierre Pichet added a comment - This should be done in the weekend.
          Hide
          ppichet Pierre Pichet added a comment -

          Done.
          Could you take a look at MDL-31680 .If OK I will create the branches.

          Show
          ppichet Pierre Pichet added a comment - Done. Could you take a look at MDL-31680 .If OK I will create the branches.
          Hide
          timhunt Tim Hunt added a comment -

          Thanks Pierre.

          Show
          timhunt Tim Hunt added a comment - Thanks Pierre.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Integrated (23, 24 and master), thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Integrated (23, 24 and master), thanks!
          Hide
          andyjdavis Andrew Davis added a comment -

          I think this is working as it should. Passing.

          Show
          andyjdavis Andrew Davis added a comment - I think this is working as it should. Passing.
          Hide
          damyon Damyon Wiese added a comment -

          This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

          Thanks for your contributions!

          Show
          damyon Damyon Wiese added a comment - This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads). Thanks for your contributions!

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/May/13