Skip to content
Permalink
Browse files

Update the stamp each time a question is edited. This is the outcome …

…of a long Skype discussion with Eloy on 15/02/06. A planned improvement for the future is to set the stamp to a md5 hash of the questiondata to ensure that identical questions will have identical stamps. Currently it is possible to obtain some duplication during question restore if between backup and restore the teacher clicks on the Save button on the editing page without acutally making any changes. Admittedly not a very likely scenario and hence the current system is good enough for now.
  • Loading branch information...
gustav_delius
gustav_delius committed Feb 16, 2006
1 parent 84f037e commit 92c781cab35c42e1ec43a75bf78bcf30a1b4d896
Showing with 6 additions and 1 deletion.
  1. +6 −1 mod/quiz/questiontypes/questiontype.php
@@ -74,13 +74,18 @@ function save_question($question, $form, $course) {
$question->defaultgrade = $form->defaultgrade;
}
// Set the unique code
// TODO: set the stamp to a hash of the questiondata so that identical
// questions will get the same stamp. That will elliminate possible
// duplication during backup when questions get changed without changes
$question->stamp = make_unique_id_code();
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!");

0 comments on commit 92c781c

Please sign in to comment.
You can’t perform that action at this time.