Calculated question bugs and new features proposal: Difference between revisions
Line 116: | Line 116: | ||
===Use the datasetdefinition_form to correct the datadefs type (private, category or not a datadef)==== | ===Use the datasetdefinition_form to correct the datadefs type (private, category or not a datadef)==== | ||
:Improve the display by using grouping mandatory and possible datasets in 2 groups | :Improve the display by using grouping mandatory and possible datasets in 2 groups | ||
:Testing | :Give infos on available category datasets with the same name | ||
:Testing that there is at least on dataset remaining on the output | |||
::(i.e. the user has not set all the datadefs to '''not a dataset''' | ::(i.e. the user has not set all the datadefs to '''not a dataset''' | ||
Revision as of 01:48, 19 February 2007
This page will be used as a TODO-List in relation to the bug tracker tasks
Main objectives
The actual plan is to
- Improve the actual calculated question
- Correct the minor problems of the new 1.8 interface and add some features
- Adding a display of the available category wild cards
- before the question text when editing the question
- in the datasetdefinition form
- Adding a display of the available category wild cards
- Correct the minor problems of the new 1.8 interface and add some features
- Improving the code flow so that if something is badly set (datadesf, dataitems) the calculated question default to a numerical one with a warning in the quiz display (and in the question name so it appears clrealy in the questions display in the question or quiz edit form).
- Adding the possibility to show calculated results in the question as data
Given {m} and {x} and {b} ask for the slope of X1 = {x} , Y1 = {= {x}*{m}+ {b}) X2 = {=2*{x}} , Y2 = {= 2*{x}*{m}+ {b}) Calculate the slope of the line So if in one set of data {x} = 2 , {m}= 1 and {b}= 3 The question display will be X1 = 2 , Y1 = 5 X2 = 4 , Y2 = 7 Calculate the slope of the curve ?
- Extending the actual php math function (sin(), cos() etc.) to complex function using php mathlibs
- Develop the calculated questiontype
- Adding multiples answers with different grade.
So to be able to grade correctly typical errors related to units (i.e.10 times more or less)
- Using these multiple answers to create a multiple choice calculated question
The user could select either type when creating the question or saving it as new question
- Going further and create a cloze version of the calculated question
allowing to have multiple questions and either multiple answers or as a multiple choice calculated question
Improvement of the user interface
- Correct the minor problems of the new 1.8 interface and add some features. The interface should give consistent results independent of the question status
- creating a new question
- editing an existing question
- saving an existing questiuon as a new question
- Removing the side effects when typing the enter key in dataitems_form.php input fields
- Verify that there is at least one wild card in either the question or the answer text.
- If so saving the datasetdefs with either
- default value ( new question)
- copy of the already defined datasetdefs when saving an existing question as a new one.
- If so saving the datasetdefs with either
- change the code so that generating datatitems value ( for a quiz or preview) can handle this without error ( or possibly a warning) and send back a value on the fly.
- Verify that there is at least one wild card in either the question or the answer text.
- adding a table showing the shareable category wild cards available in the first page of question creation or edition
- identifying more clearly which of the wild cards has an already defined shareable category wild cards available
- Removing the side effects when typing the enter key in dataitems_form.php input fields
- ...
Adding new class functions or make substantial change to existing one
- adding a table display function showing the shareable category wild cards available in the first page of question creation or edition
- a general function for the abstractype class (showing only the name and nb of items)
- a specific function for the calculatedquestion class showing the definition (min:max:type) in a user readable format.
- ...
Modifying the code flow to remove the use of $SESSION to save data in the three steps question creation process
Check that there is at least one wild card {param} before leaving calculated_question_form
Use the moodleform->validate for the presence of at least one wild card
$possibledatasets = $this->qtypeobj->find_dataset_names($data['questiontext']); $mandatorydatasets = array(); foreach ($answers as $key => $answer){ $mandatorydatasets += $this->qtypeobj->find_dataset_names($data['questiontext']); } if (count($possibledatasets) == 0 && count($mandatorydatasets )==0){ $errors['questiontext']=get_string('atleastonedataset', 'qtype_calculated'); foreach ($answers as $key => $answer){ $errors['answers['.$key.']'] = get_string('atleastonedataset', 'qtype_calculated'); } }
Save the question data (text, answers, units) on leaving calculated_question_form
Doing this, on return from parent:save_question there will be a valid question->id
Discriminate saving a new question, editing an actual question or saving as new an actual question
- When creating a new question the $form->id == 0
- When saving as a new question $form->makecopy exist and $form->id contains the id of the original question.
- Editing an actual question is the last option
Save wild cards on processing calculated_question_form
The resulting code flow when saving the question and the wild cards.
- There are two new functions added in datasetdependent/abstractype.php
- The function preparedatasets($form,$question->id) build a dataset structure similar to the datasetdefinitions_form.php
- in the new question case, the mandatory datasetdefs (those in the answers) are defined as private to the question.
- The possible datasetdefs(only in question text) are default as not a dataset.
- The function save_as_new_dataset_definitions copy the datadefs and data items from the initial question if they are used in the new one.
- The function preparedatasets($form,$question->id) build a dataset structure similar to the datasetdefinitions_form.php
switch($wizardnow) { case : case 'question': // coming from the first page, creating the second if (empty($form->id)) { // for a new question $form->id is empty $question = parent::save_question($question, $form, $course); //prepare the datasets using default $questionfromid $form->datasets = $this->preparedatasets($form); $form->id = $question->id; $this->save_dataset_definitions($form); } else if (!empty($form->makecopy)){ $questionfromid = $form->id ; $question = parent::save_question($question, $form, $course); //prepare the datasets $form->datasets = $this->preparedatasets($form,$questionfromid); $form->id = $question->id; $this->save_as_new_dataset_definitions($form,$questionfromid ); } else {// editing a question $question = parent::save_question($question, $form, $course); //prepare the datasets $form->datasets = $this->preparedatasets($form,$question->id); $form->id = $question->id; $this->save_dataset_definitions($form); } break; case 'datasetdefinitions': $this->save_dataset_definitions($form); break; case 'datasetitems': $this->save_dataset_items($question, $form); break;
Use the datasetdefinition_form to correct the datadefs type (private, category or not a datadef)=
- Improve the display by using grouping mandatory and possible datasets in 2 groups
- Give infos on available category datasets with the same name
- Testing that there is at least on dataset remaining on the output
- (i.e. the user has not set all the datadefs to not a dataset
Use the datasetitem_form to define the wild cards and add dataitems
- line 29 , 38- in datasetdependent/datasetdefinitions.form.php
- numerous lines in datasetdependent/abstractype.php
- line 31, 36- in datasetdependent/datasetitems_form.php
List of files modified in the project
- calculated/edit_calculated_form.php
- calculated/questiontype.php
- datasetdependent/abstractype.php
- datasetdependent/datasetdefinitions.form.php
- datasetdependent/datasetitems_form.php
Improvement to import-export process and question category moving
- There is no way to import calculated questions in Moodle actually.The steps to correct this are:
- Adding an importdatadef() function and import dataitem function() to calculated questiontype class
- adding a preliminary verifyimporteddata() function to calculated questiontype class
- modify the savequestion() and saveoptions() function to accept import data.
- ...
Working list of bugs solved but not transfered to Moodle code
Here is a continuously updated list of the bugs (or improvements ) reported on the Moodle tracker with a working solution and waiting for approval and transfer to Moodle by Tim Hunt. This working list facilitates the collaboration between the author ( Pierre Pichet) and Tim .
MDL-8552 The dataitem number is not choosen correctly when using a calculated question in a quiz
MDL-8432 The checking that there is at least one dataset item to allow back to quiz when editing calculated question is not working properly
MDL-8447 The default answer fraction is not settled correctly on the edit_calculated form, a solution is proposed
MDL-8478 Small numerical answers i.e. 1e-18 are not graded correctly
(to be continued)Pierre Pichet 17 February 2007