<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3ACalculated_question_bugs_and_new_features_proposal</id>
	<title>Development:Calculated question bugs and new features proposal - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3ACalculated_question_bugs_and_new_features_proposal"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Calculated_question_bugs_and_new_features_proposal&amp;action=history"/>
	<updated>2026-05-07T02:12:33Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Calculated_question_bugs_and_new_features_proposal&amp;diff=10886&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Calculated_question_bugs_and_new_features_proposal&amp;diff=10886&amp;oldid=prev"/>
		<updated>2024-10-21T08:51:03Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:51, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Calculated_question_bugs_and_new_features_proposal&amp;diff=10885&amp;oldid=prev</id>
		<title>1&gt;Ppichet: /* Use the datasetitem_form to define the wild cards and add dataitems */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Calculated_question_bugs_and_new_features_proposal&amp;diff=10885&amp;oldid=prev"/>
		<updated>2007-02-19T01:51:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Use the datasetitem_form to define the wild cards and add dataitems&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page will be used as a TODO-List in relation to the bug tracker tasks &lt;br /&gt;
** MDL-8387 , MDL-8389 ,MDL-8395 and MDL-8396&lt;br /&gt;
==Main objectives==&lt;br /&gt;
The actual plan is to&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Improve the actual calculated question&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** Correct the minor problems of the new 1.8 interface and add some features&lt;br /&gt;
***Adding a display of the available category wild cards&lt;br /&gt;
****before the question text when editing the question&lt;br /&gt;
****in the datasetdefinition form&lt;br /&gt;
&lt;br /&gt;
** 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).&lt;br /&gt;
** Adding the possibility to show calculated results in the question as data &lt;br /&gt;
     Given {m} and {x} and {b} ask for the slope of&lt;br /&gt;
     X1 = {x}  , Y1 = {= {x}*{m}+ {b})          &lt;br /&gt;
     X2 = {=2*{x}}  , Y2 = {= 2*{x}*{m}+ {b})&lt;br /&gt;
     Calculate the slope of the line&lt;br /&gt;
     So if in one set of data {x} = 2 , {m}= 1 and {b}= 3&lt;br /&gt;
     The question display will be &lt;br /&gt;
     X1 = 2 , Y1 = 5&lt;br /&gt;
     X2 = 4 , Y2 = 7&lt;br /&gt;
     Calculate the slope of the curve ?&lt;br /&gt;
     &lt;br /&gt;
** Extending the actual php math function (sin(), cos() etc.) to complex function using php mathlibs&lt;br /&gt;
     &lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Develop the calculated questiontype&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
**Adding multiples answers with different grade. &lt;br /&gt;
      So to be able to grade correctly typical errors related to units (i.e.10 times more or less)    &lt;br /&gt;
**Using these multiple answers to create a multiple choice calculated question&lt;br /&gt;
      The user could select either type when creating the question  or saving it as new question&lt;br /&gt;
**Going further and create a cloze version of the calculated question &lt;br /&gt;
    allowing to have multiple questions &lt;br /&gt;
    and either &lt;br /&gt;
      multiple answers or&lt;br /&gt;
      as a multiple choice calculated question&lt;br /&gt;
&lt;br /&gt;
==Improvement of the user interface==&lt;br /&gt;
#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 &lt;br /&gt;
* creating a new question&lt;br /&gt;
* editing an existing question&lt;br /&gt;
* saving an existing questiuon as a new question&lt;br /&gt;
##Removing the side effects when typing the enter key in dataitems_form.php input fields&lt;br /&gt;
###Verify that there is at least one wild card in either the question or the answer text.&lt;br /&gt;
####If so saving the datasetdefs with either &lt;br /&gt;
#####default value ( new question)&lt;br /&gt;
#####copy of the already defined datasetdefs when saving an existing question as a new one.&lt;br /&gt;
###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.&lt;br /&gt;
##adding a table showing the shareable category wild cards available in the first page of question creation or edition&lt;br /&gt;
##identifying more clearly which of the wild cards has an already defined shareable category wild cards available&lt;br /&gt;
# ...&lt;br /&gt;
&lt;br /&gt;
==Adding new class functions or make substantial change to existing one==&lt;br /&gt;
# adding a table display function showing the shareable category wild cards available in the first page of question creation or edition&lt;br /&gt;
##a general function for the abstractype class (showing only the name and nb of items)&lt;br /&gt;
## a specific function for the calculatedquestion class showing the definition (min:max:type) in a user readable format.&lt;br /&gt;
# ...&lt;br /&gt;
==Modifying the code flow to remove the use of $SESSION to save data in the three steps question creation process==&lt;br /&gt;
===Check that there is at least one wild card {param} before leaving calculated_question_form===&lt;br /&gt;
Use the moodleform-&amp;gt;validate for the presence of at least one wild card&lt;br /&gt;
         $possibledatasets = $this-&amp;gt;qtypeobj-&amp;gt;find_dataset_names($data[&amp;#039;questiontext&amp;#039;]);&lt;br /&gt;
        $mandatorydatasets = array();&lt;br /&gt;
        foreach ($answers as $key =&amp;gt; $answer){&lt;br /&gt;
            $mandatorydatasets += $this-&amp;gt;qtypeobj-&amp;gt;find_dataset_names($data[&amp;#039;questiontext&amp;#039;]);&lt;br /&gt;
        }      &lt;br /&gt;
        if (count($possibledatasets) == 0 &amp;amp;&amp;amp; count($mandatorydatasets )==0){&lt;br /&gt;
            $errors[&amp;#039;questiontext&amp;#039;]=get_string(&amp;#039;atleastonedataset&amp;#039;, &amp;#039;qtype_calculated&amp;#039;);&lt;br /&gt;
            foreach ($answers as $key =&amp;gt; $answer){&lt;br /&gt;
                $errors[&amp;#039;answers[&amp;#039;.$key.&amp;#039;]&amp;#039;] = get_string(&amp;#039;atleastonedataset&amp;#039;, &amp;#039;qtype_calculated&amp;#039;);&lt;br /&gt;
            }      &lt;br /&gt;
        }&lt;br /&gt;
===Save the question data (text, answers, units) on leaving calculated_question_form===&lt;br /&gt;
Doing this, on return from parent:save_question there will be a valid question-&amp;gt;id&lt;br /&gt;
&lt;br /&gt;
===Discriminate saving a new question, editing an actual question or saving as new an actual question===&lt;br /&gt;
#When creating a new question the $form-&amp;gt;id == 0 &lt;br /&gt;
#When saving as a new question $form-&amp;gt;makecopy exist and $form-&amp;gt;id contains the id of the original question.&lt;br /&gt;
#Editing an actual question is the last option&lt;br /&gt;
&lt;br /&gt;
===Save wild cards on processing calculated_question_form===&lt;br /&gt;
The resulting code flow when saving the question and the wild cards.&lt;br /&gt;
:There are two new functions added in datasetdependent/abstractype.php&lt;br /&gt;
::The function &amp;#039;&amp;#039;&amp;#039;preparedatasets&amp;#039;&amp;#039;&amp;#039;($form,$question-&amp;gt;id) build a dataset structure similar to the datasetdefinitions_form.php&lt;br /&gt;
:::in the new question case, the mandatory datasetdefs (those in the answers) are defined as private to the question. &lt;br /&gt;
:::The possible datasetdefs(only in question text) are default as not a dataset. &lt;br /&gt;
::The function &amp;#039;&amp;#039;&amp;#039;save_as_new_dataset_definitions&amp;#039;&amp;#039;&amp;#039; copy the datadefs and data items from the initial question if they are used in the new one.&lt;br /&gt;
        switch($wizardnow) {&lt;br /&gt;
            case &amp;#039;&amp;#039; :&lt;br /&gt;
            case &amp;#039;question&amp;#039;: // coming from the first page, creating the second                &lt;br /&gt;
                if (empty($form-&amp;gt;id)) { // for a new question $form-&amp;gt;id is empty&lt;br /&gt;
                   $question = parent::save_question($question, $form, $course); &lt;br /&gt;
                   //prepare the datasets using default $questionfromid&lt;br /&gt;
                   $form-&amp;gt;datasets = $this-&amp;gt;&amp;#039;&amp;#039;&amp;#039;preparedatasets&amp;#039;&amp;#039;&amp;#039;($form);&lt;br /&gt;
                   $form-&amp;gt;id = $question-&amp;gt;id;&lt;br /&gt;
                   $this-&amp;gt;save_dataset_definitions($form);&lt;br /&gt;
                } else if (!empty($form-&amp;gt;makecopy)){ &lt;br /&gt;
                   $questionfromid =  $form-&amp;gt;id ;&lt;br /&gt;
                   $question = parent::save_question($question, $form, $course);&lt;br /&gt;
                    //prepare the datasets&lt;br /&gt;
                    $form-&amp;gt;datasets = $this-&amp;gt;preparedatasets($form,$questionfromid);                   &lt;br /&gt;
                    $form-&amp;gt;id = $question-&amp;gt;id;&lt;br /&gt;
                    $this-&amp;gt;&amp;#039;&amp;#039;&amp;#039;save_as_new_dataset_definitions&amp;#039;&amp;#039;&amp;#039;($form,$questionfromid );&lt;br /&gt;
                }  else {// editing a question &lt;br /&gt;
                    $question = parent::save_question($question, $form, $course);&lt;br /&gt;
                    //prepare the datasets&lt;br /&gt;
                    $form-&amp;gt;datasets = $this-&amp;gt;&amp;#039;&amp;#039;&amp;#039;preparedatasets&amp;#039;&amp;#039;&amp;#039;($form,$question-&amp;gt;id);&lt;br /&gt;
                    $form-&amp;gt;id = $question-&amp;gt;id; &lt;br /&gt;
                    $this-&amp;gt;save_dataset_definitions($form);&lt;br /&gt;
                 }                    &lt;br /&gt;
                break;&lt;br /&gt;
            case &amp;#039;datasetdefinitions&amp;#039;:&lt;br /&gt;
                    $this-&amp;gt;save_dataset_definitions($form);&lt;br /&gt;
                break;&lt;br /&gt;
            case &amp;#039;datasetitems&amp;#039;:&lt;br /&gt;
                $this-&amp;gt;save_dataset_items($question, $form);&lt;br /&gt;
                break;&lt;br /&gt;
&lt;br /&gt;
===Use the datasetdefinition_form to correct the datadefs type (private, category or not a datadef)====&lt;br /&gt;
:Improve the display by using grouping mandatory and possible datasets in 2 groups&lt;br /&gt;
:Give infos on available category datasets with the same name&lt;br /&gt;
:Testing that there is at least on dataset remaining on the output &lt;br /&gt;
::(i.e. the user has not set all the datadefs to &amp;#039;&amp;#039;&amp;#039;not a dataset&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===Use the datasetitem_form to define the wild cards and add dataitems===&lt;br /&gt;
:the actual display has some bugs to be solved elsewhere[http://tracker.moodle.org/browse/MDL-8391 MDL-8391]&lt;br /&gt;
&lt;br /&gt;
===Removal of references to $SESSION data related to datasetdefs or data items===&lt;br /&gt;
#line 29 , 38- in datasetdependent/datasetdefinitions.form.php&lt;br /&gt;
#numerous lines in datasetdependent/abstractype.php&lt;br /&gt;
#line 31, 36- in datasetdependent/datasetitems_form.php&lt;br /&gt;
&lt;br /&gt;
===List of files modified in the project ===&lt;br /&gt;
# calculated/edit_calculated_form.php&lt;br /&gt;
# calculated/questiontype.php&lt;br /&gt;
# datasetdependent/abstractype.php&lt;br /&gt;
# datasetdependent/datasetdefinitions.form.php&lt;br /&gt;
# datasetdependent/datasetitems_form.php&lt;br /&gt;
&lt;br /&gt;
==Improvement to import-export process and question category moving==&lt;br /&gt;
&lt;br /&gt;
#There is no way to import calculated questions in Moodle actually.The steps to correct this are:&lt;br /&gt;
## Adding an importdatadef() function and import dataitem function() to calculated questiontype class&lt;br /&gt;
## adding a preliminary verifyimporteddata() function to calculated questiontype class&lt;br /&gt;
## modify the savequestion() and saveoptions() function to accept import data.&lt;br /&gt;
## ...&lt;br /&gt;
&lt;br /&gt;
==Working list of bugs solved but not transfered to Moodle code==&lt;br /&gt;
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.&lt;br /&gt;
This working list facilitates the collaboration between the author ( Pierre Pichet) and Tim .&lt;br /&gt;
&lt;br /&gt;
MDL-8552 The dataitem number is not choosen correctly when using a calculated question in a quiz&lt;br /&gt;
&lt;br /&gt;
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&lt;br /&gt;
&lt;br /&gt;
MDL-8447 The default answer fraction is not settled correctly on the edit_calculated form, a solution is proposed&lt;br /&gt;
&lt;br /&gt;
MDL-8478 Small numerical answers i.e. 1e-18 are not graded correctly&lt;br /&gt;
   &lt;br /&gt;
 &lt;br /&gt;
(to be continued)[[User:Pierre Pichet|Pierre Pichet]] 17 February 2007&lt;/div&gt;</summary>
		<author><name>1&gt;Ppichet</name></author>
	</entry>
</feed>