Skip to content
Snippets Groups Projects
Commit 5ffbd92d authored by srosse's avatar srosse
Browse files

OO-1011: persist new checklist

parent 2691d0df
No related branches found
No related tags found
No related merge requests found
...@@ -160,7 +160,8 @@ public class ChecklistCourseNode extends AbstractAccessableCourseNode { ...@@ -160,7 +160,8 @@ public class ChecklistCourseNode extends AbstractAccessableCourseNode {
} else } else
// this is part of a copied course, the original checklist will be copied // this is part of a copied course, the original checklist will be copied
if(getModuleConfiguration().get(CONF_CHECKLIST) != null) { if(getModuleConfiguration().get(CONF_CHECKLIST) != null) {
Checklist orgChecklist = ChecklistManager.getInstance().loadChecklist((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST)); Checklist confChecklist = (Checklist)getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
Checklist orgChecklist = ChecklistManager.getInstance().loadChecklist(confChecklist);
checklist = ChecklistManager.getInstance().copyChecklist(orgChecklist); checklist = ChecklistManager.getInstance().copyChecklist(orgChecklist);
} else { } else {
// no checklist available, create new one // no checklist available, create new one
......
...@@ -95,7 +95,12 @@ public class ChecklistManager { ...@@ -95,7 +95,12 @@ public class ChecklistManager {
*/ */
public Checklist saveChecklist(Checklist cl) { public Checklist saveChecklist(Checklist cl) {
cl.setLastModified(new Date()); cl.setLastModified(new Date());
return DBFactory.getInstance().getCurrentEntityManager().merge(cl); if(cl.getKey() == null) {
DBFactory.getInstance().getCurrentEntityManager().persist(cl);
} else {
cl = DBFactory.getInstance().getCurrentEntityManager().merge(cl);
}
return cl;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment