From 0fc550a5cc21c84dcee04db7aed80cac14ef777c Mon Sep 17 00:00:00 2001 From: Pierre Pichet Date: Fri, 7 May 2010 22:08:27 +0000 Subject: [PATCH] MDL-22386 merge from HEAD setting correctly the number of dataitem when duplicating a calculated, calculatedsimple, calculatedmulti question --- question/type/datasetdependent/abstractqtype.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/question/type/datasetdependent/abstractqtype.php b/question/type/datasetdependent/abstractqtype.php index c43eaeebfbf..0dcd75ccc22 100644 --- a/question/type/datasetdependent/abstractqtype.php +++ b/question/type/datasetdependent/abstractqtype.php @@ -468,8 +468,13 @@ class question_dataset_dependent_questiontype extends default_questiontype { } $itemcount++; } - //update item count - $datasetdef->itemcount =$itemcount; + //update item count to olditemcount if + // at least this number of items has been recover from the database + if( $olditemcount <= $itemcount ) { + $datasetdef->itemcount = $olditemcount; + } else { + $datasetdef->itemcount = $itemcount ; + } update_record('question_dataset_definitions', $datasetdef); } // end of copy the dataitems }// end of copy the datasetdef