Note:

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

Calculated question type creation: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 16: Line 16:
==Creating a calculated question==
==Creating a calculated question==
Actually the creation of a calculated question is a three step process
Actually the creation of a calculated question is a three step process
* Defining the common question parameters
* '''Defining the common question parameters'''
** Question name
** Question name
** Question text
** Question text
** answer formula, limit, units
** answer formula, limit, units
* Defining if the dataset definitions ({params} are to be used in this question only or could be used by other questions in the question category in which the question is created.
* '''Defining the dataset definitions range''' for each of them. The dataset definition ({params}) can be used in this new question only or could be used or add been already created by other questions in the question category in which the new question is created.
   question category is a set of questions that can contain various question types
   question category is a set of questions that can contain various question types
* Defining the dataset definitions parameters (min,max, decimal and generation mode and adding at least one data item for each dataset definitions
* '''Defining the dataset definitions parameters''' (min,max, decimal and generation mode and '''adding''' at least one data item for each dataset definitions
  Actually a set of all the data items is created when you click the add button
  Actually a set of all the data items is created when you click the add button



Revision as of 07:29, 13 June 2006

Its a first try as you could see. I will use this page to describe the PHP code principal processes of the calculated question creation and see how it could be improved.

Calculated question parameters

Calculated question is an extended numerical question where parameters of a mathematical problems are generated and used to calculate the answer using a mathematical formula.

So the answer parameter of a numerical question is replaced by the mathematical formula using the same answer database structure that the numerical question.

The generated parameters are identified by a special format that is not used in a mathematical PHP equation {param} where the param name begins by a letter and can include alphanumerics symbol a-z A-Z _ 0-9

ex. {ad} {a_2} {a4_r} are valid parameter names 
{1a} {a+1} {a(0)} are invalid parameter names
 

These parameters are transform in datasets defined by a min,max,decimal and generation mode. Using these datasets definitions a number of different values are generated (the dataset items) and used to generate different question instances where the parameters have different values although the question structure and answer formula are constant.

Creating a calculated question

Actually the creation of a calculated question is a three step process

  • Defining the common question parameters
    • Question name
    • Question text
    • answer formula, limit, units
  • Defining the dataset definitions range for each of them. The dataset definition ({params}) can be used in this new question only or could be used or add been already created by other questions in the question category in which the new question is created.
 question category is a set of questions that can contain various question types
  • Defining the dataset definitions parameters (min,max, decimal and generation mode and adding at least one data item for each dataset definitions
Actually a set of all the data items is created when you click the add button