summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastian.gottfried@posteo.de>2016-12-01 13:13:35 (GMT)
committerSebastian Gottfried <sebastian.gottfried@posteo.de>2016-12-01 13:13:35 (GMT)
commit6def386ea3fade0f12950b06552a15c7c6725933 (patch)
tree4d09f620534bf107b7252264e80aa4cabadad675
parent816c550bae1e0169e64c4285f1afcfe22e759a61 (diff)
Course Editor: Fix Course Duplicationv16.11.90
The editor has the feature to create a new course based on an existing. All lessons from all courses are stored in a single database with a unique constraint on the ID column. This makes it necessary to assign new IDs for the lessons of the new course.
-rw-r--r--src/editor/newresourceassistant.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/editor/newresourceassistant.cpp b/src/editor/newresourceassistant.cpp
index 1d426b8..f4b0f1d 100644
--- a/src/editor/newresourceassistant.cpp
+++ b/src/editor/newresourceassistant.cpp
@@ -21,6 +21,7 @@
#include "core/resource.h"
#include "core/course.h"
+#include "core/lesson.h"
#include "core/keyboardlayout.h"
#include "core/dataindex.h"
#include "core/dataaccess.h"
@@ -72,6 +73,10 @@ Resource* NewResourceAssistant::createResource()
DataAccess dataAccess;
dataAccess.loadCourse(templateDataIndexCourse, &templateCourse);
course->copyFrom(&templateCourse);
+ for (int i = 0; i < course->lessonCount(); i++)
+ {
+ course->lesson(i)->setId(QUuid::createUuid().toString());
+ }
}
course->setId(QUuid::createUuid().toString());