mirror of
https://github.com/moodle/moodle.git
synced 2025-01-21 23:48:45 +01:00
New questions created via GUI or imported are now given a unique
stamp, and a default version of 1. When questions are updated, the version number is incremented.
This commit is contained in:
parent
1923285635
commit
8826c67031
@ -169,6 +169,9 @@ class quiz_file_format extends quiz_default_format {
|
||||
continue;
|
||||
}
|
||||
|
||||
$question->stamp = make_unique_id_code(); // Set the unique code (not to be changed)
|
||||
$question->version = 1; // Original version of this question
|
||||
|
||||
if (!$question->id = insert_record("quiz_questions", $question)) {
|
||||
error("Could not insert new question!");
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ class quiz_default_format {
|
||||
echo "<hr><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
|
||||
|
||||
$question->category = $this->category->id;
|
||||
$question->stamp = make_unique_id_code(); // Set the unique code (not to be changed)
|
||||
$question->version = 1; // Original version of this question
|
||||
|
||||
if (!$question->id = insert_record("quiz_questions", $question)) {
|
||||
error("Could not insert new question!");
|
||||
|
@ -119,10 +119,13 @@
|
||||
} else {
|
||||
|
||||
if (!empty($question->id)) { // Question already exists
|
||||
$question->version ++; // Update version number of question
|
||||
if (!update_record("quiz_questions", $question)) {
|
||||
error("Could not update question!");
|
||||
}
|
||||
} else { // Question is a new one
|
||||
$question->stamp = make_unique_id_code(); // Set the unique code (not to be changed)
|
||||
$question->version = 1;
|
||||
if (!$question->id = insert_record("quiz_questions", $question)) {
|
||||
error("Could not insert new question!");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user