Skip to content

Commit

Permalink
MDL-14406
Browse files Browse the repository at this point in the history
Ensure 'length' field for description type questions is 0 and that
default for all questions is 0

Merged from STABLE_19
  • Loading branch information
thepurpleblob committed May 1, 2008
1 parent 64fcd67 commit 3f5633d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions question/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ function create_category_path($catpath, $delimiter='/') {
}
return $category;
}

/**
* Return complete file within an array, one item per line
* @param string filename name of file
Expand Down Expand Up @@ -474,6 +475,7 @@ function defaultquestion() {
$question->incorrectfeedback = '';
$question->answernumbering = 'abc';
$question->penalty = 0.1;
$question->length = 1;

// this option in case the questiontypes class wants
// to know where the data came from
Expand Down Expand Up @@ -550,6 +552,7 @@ function importimagefile( $path, $base64 ) {
return $newfile;
}


/*******************
* EXPORT FUNCTIONS
*******************/
Expand Down Expand Up @@ -703,6 +706,7 @@ function exportprocess() {
fclose($fh);
return true;
}

/**
* get the category as a path (e.g., tom/dick/harry)
* @param int id the id of the most nested catgory
Expand Down
2 changes: 2 additions & 0 deletions question/format/gift/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ function readquestion($lines) {

switch ($question->qtype) {
case DESCRIPTION:
$question->defaultgrade = 0;
$question->length = 0;
return $question;
break;
case ESSAY:
Expand Down
2 changes: 2 additions & 0 deletions question/format/xml/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ function import_description( $question ) {
$qo = $this->import_headers( $question );
// header parts particular to shortanswer
$qo->qtype = DESCRIPTION;
$qo->defaultgrade = 0;
$qo->length = 0;
return $qo;
}

Expand Down

0 comments on commit 3f5633d

Please sign in to comment.