In fact the problems I have to set up consist, for a given dataset of parameters, in calculating some other parameters; the student should input the answers in appropriate blank fields available in the question itself. But in the actual version of calculated questions, seem to me, I can ask to calculate only one parameter. Is that true or I am doing some mistake? If I am right, is on going any improvement in that sense?
In fact the problems I have to set up consist, for a given dataset of parameters, in calculating some other parameters; the student should input the answers in appropriate blank fields available in the question itself. But in the actual version of calculated questions, seem to me, I can ask to calculate only one parameter. Is that true or I am doing some mistake? If I am right, is on going any improvement in that sense?
See http://moodle.org/mod/forum/discuss.php?d=74021
Pierre
P.S.The work is postponed a little as I am also working on the multianswer (cloze) type. I want to create a code that will be usefull for 'all' multianswer type questions.
Not now but something in a near future like january...
Pierre
P.S. This is a complex thing to set and this is why I am working now on improving multianswer (Cloze) coding.
Hi Pierre,
I am afraid, I can't wait that long (and especially longer). Therefore, I was wondering, if it is possible to change some code, write a plugin, whatever ... in order to force moodle to reuse the individual values of shared wild cards within one category for each student. That's actually all I need!
I will try again to explain a bit more in detail to make things clear: Currently, it is possible to share wildcards within one category in such a way that each occurance of a wildcard variable (in different questions) accesses the same random item set for that wildcard variable but, however, it chooses for each question a random value from that set. I simply want to make moodle to use only one item of that random item set for each quiz taker for each wildcard variable in all questions in a category. Hope it's clear?!?
Do you think this approach is feasable?
Cheers
Bernd
Are you using this for a small moodle installation i.e. one course or a large installation?
Are you using thiseas part of the grading process or as an exercise?
And which moodle version ?
At a small scale I could furnish you an experimental version of the project.
Pierre
You put somewhere in the introduction text of the quiz the expression 'synchronize_calculated' and your calculated questions will use the same data number.
You need to modify the question/type/calculated/questiontype.php part that is bold, not all the function because the database calls are specific to 2.0
function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {
// Find out how many datasets are available
global $CFG, $DB;
if(!$maxnumber = (int)$DB->get_field_sql(
"SELECT MIN(a.itemcount)
FROM {question_dataset_definitions} a,
{question_datasets} b
WHERE b.question = ?
AND a.id = b.datasetdefinition", array($question->id))) {
print_error('cannotgetdsforquestion', 'question', '', $question->id);
}
// Choose a random dataset
if (!isset($cmoptions->intro) || strstr($cmoptions->intro, 'synchronize_calculated') === false ) {
$state->options->datasetitem = rand(1, $maxnumber);
}else{
if( !isset($cmoptions->synchronize_calculated)) {
$state->options->datasetitem = rand(1, $maxnumber);
$cmoptions->synchronize_calculated = $state->options->datasetitem ;
}else {
if ($cmoptions->synchronize_calculated <= $maxnumber){
$state->options->datasetitem = $cmoptions->synchronize_calculated ;
}else {
$state->options->datasetitem = rand(1, $maxnumber);
}
}
};
$state->options->dataset =
$this->pick_question_dataset($question,$state->options->datasetitem);
$state->responses = array('' => '');
return true;
}
You should create the same number of items for each datasets.
Also note that the number used is applied to all datasets private or category.
I think I will use this feature so thanks for the cue.
Pierre
Great, works perfectly so far...
For everyone who is interested and does not use Moodle 2.0 yet, but for example release 1.9.3 (like I do) here is the corresponding howto. Note however, that this approach permanently synchronizes variables, i.e. it is not necessary to put the text 'synchronize_calculated' in the intro field of the quiz:
Simply replace line 44 in "moodle\question\type\datasetdependent\abstractqtype.php" with the following code:
if( !isset($cmoptions->synchronize_calculated)) {
$state->options->datasetitem = rand(1, $maxnumber);
$cmoptions->synchronize_calculated = $state->options->datasetitem ;
}else {
if ($cmoptions->synchronize_calculated <= $maxnumber){
$state->options->datasetitem = $cmoptions->synchronize_calculated ;
}else {
$state->options->datasetitem = rand(1, $maxnumber);
}
};
Cheers,
Bernd
Pierre