Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Calculated question 1.7 bug solving proposal: Difference between revisions

From MoodleDocs
(This page will not be migrated to new devdocs)
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page will describe the various improvements and bugs solving that are being planned for 1.7 release.
{{Template:WillNotMigrate}}
I almost suceed in developping a "cloze" version of the calculated question with a lot of interesting features.
However the actual calculated qusetion needs more basic improvements or bug solving.
I will list here the order in which I propose to solve them.
I have already a working solution for most of the following items although each of them need to be tested before porting in the Moodle code.
==Removing old code==
There is a quite large number of code older that 1.5 that is always present in the
calculated/questiontype.php or datasetdependet/abstractype.php
some already as comments in abstractype.php line 374-483
/*
 
    function save_question($question, &$form, $course) {
  ----
        }
        return true;
    }
*/
 
and the function  line 140 of  questiontype.php
  function create_runtime_question($question, $form) {
        $question = parent::create_runtime_question($question, $form);
        $question->options->answers = array();
        foreach ($form->answers as $key => $answer) {
            $a->answer              = trim($form->answer[$key]);
            $a->tolerance          = $form->tolerance[$key];
            $a->tolerancetype      = $form->tolerancetype[$key];
            $a->correctanswerlength = $form->correctanswerlength[$key];
            $a->correctanswerformat = $form->correctanswerformat[$key];
            $question->options->answers[] = clone($a);
        }
        return $question;
    }
the question = parent::create_runtime_question($question, $form);
i.e datasetdependet/abstractype.php/create_runtime_question($question, $form); is already
as comments as just described  (lines 432-463).
A search in Moodle_15_STABLE, Moodle_16_STABLE and Moodle_17_STABLE shows that this function is no more used.
the function (lines 155-199) of  questiontype.php is no more used
    function validate_form($form) {
        switch($form->wizardpage) {
            case 'question':
  -----
            default:
                return parent::validate_form($form);
                break;
        }
        return true;
    }
as the parent::validate_form($form); i.e. abstractype.php/validate_form($form);
the call to these functions line 211 of abstractype is already a comment
        // $this->validate_form($form);
this is true also for Moodle_15_STABLE.
So ALL these function were removed either in calculated/questiontype.php or datasetdependet/abstractype.php.
 
==Management of datasets shareable over a category==
===Bad choice of data item number when generating a question [http://tracker.moodle.org/browse/MDL-6777 MDL-6777]===
The calculated question allow to define datasets variable (i.e. {a}) that could be common to questions from the same category.
This NEVER work correctly because you can define a common variable say {b} in question 1 , create say 6 data items.
Create a question 2 that will use the same common {b} in another equation (ex. {cb}+{c}.
You then create a number of datasets for example 2 dataitems so question 2 will have 2 new {c} data items and will use 2 {b} common dataitems
When you will attempt question 2, the actual code will choose the data item number between 6 and 1 so most often the question will retrun with an error. There is a solution and with some simple testing it could be coded in 1.7, 1.6 and even 1.5 (with change in the table names (i.e. question_datasets to quiz_question_datasets ).
See details notes in[[Calculated question validating the datasets]]
 
=== Adding a table showing the available datasets in the category.===
There is no place where this information is available, you just need to memorize it!
This table should be shown in the 3 steps
*Step1 When you write the question and equations
*Step2 When you decide to use or not a shareable dataset
*Step3 When you add data items, the table showing you the number of dataitems already in the shareable datasets that you used.
The first proposal diplay all the shareable datasets in the category .[http://www.chimie.uqam.ca/images/0610/alongname.jpg example]
But we could restrict to the one used by the question in the step3
===Saving datasets and generating default data items by default when sang questions===
The actual calculated question creation process is a 3 steps process and nothin is saved until you create a first dataitem.
However when you edit a question '''everything'''is saved at each of the 3 steps.
So the proposals are in this order
 
====Saving the data sets after step 1====
Use and modify the actual functions so that
#default datasets specific to this question (i.e. dataset_definitions->category set to 0) are generated.If the user at step 2 change his mind to shareable datasets the actual code will change it correctly as when editing an exiting question.
# Generate a data item is on the fly is the question is used before the user do the 3 steps process. A Notify should be done so that qhen testing the question or the quiz the user see the problem.
 
==Should we create a status parameter in question table?==
This status could be used to warn the user when he access the questions display by the showbank.php.
The status could contains warnings, errors or nothing (i.e. OK) and be modified when saving question or question options.
 
==Adding multi answer capability to calculated question==
Integrating the numerical question code.
==Coding a more general solution to moving questions to another category.==
Actually ( up to 1.7 HEAD moving questions to another category is done in showbank.php.
See [[Calculated_question_development#Moving_calculated_questions_to_another_category]].
 
This apply also to other complex questiontypes like cloze (i.e. multianswer) type.
 
==Creating a cloze version of calculated question==
The actual prototype allows to edit up to 5 subquestions as illustrated by this prewiew[http://www.chimie.uqam.ca/images/first.jpg]
 
==Creating a  subquestions interface in the actual cloze question ==
Following the work done on calculated question cloze version.

Latest revision as of 14:05, 3 May 2024


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.