diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index 1307ea84fb7983fd39d7f9c320dfb79af6ec184d..367f5e219e1eb09febc35b5c87b91b26c8ca1ee3 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -2117,6 +2117,8 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware List<Document> answers = new ArrayList<Document>(); // We can then push answers together with interposed questions in one large bulk request List<Document> interposedQuestions = new ArrayList<Document>(); + // Motds shouldn't be forgotten + List<Document> motds = new ArrayList<Document>(); try { // add session id to all questions and generate documents for (ImportExportQuestion question : importSession.getQuestions()) { @@ -2163,8 +2165,20 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware q.put("creator", ""); interposedQuestions.add(q); } + for (Motd m : importSession.getMotds()) { + final Document d = new Document(); + d.put("type", "motd"); + d.put("motdkey", m.getMotdkey()); + d.put("title", m.getTitle()); + d.put("audience", m.getAudience()); + d.put("sessionkey", session.getKeyword()); + d.put("startdate", String.valueOf(m.getStartdate())); + d.put("enddate", String.valueOf(m.getEnddate())); + motds.add(d); + } List<Document> documents = new ArrayList<Document>(answers); documents.addAll(interposedQuestions); + documents.addAll(motds); database.bulkSaveDocuments(documents.toArray(new Document[documents.size()])); } catch (IOException e) { LOGGER.error("Could not import this session: {}", e.getMessage()); diff --git a/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java b/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java index c8b1ce0c1336c7d0e1aade54e19a7b5172e8a844..cab3881f40e6b8752c937b4ddc0e3da1fda92743 100644 --- a/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java +++ b/src/test/java/de/thm/arsnova/dao/StubDatabaseDao.java @@ -501,6 +501,12 @@ public class StubDatabaseDao implements IDatabaseDao { return null; } + @Override + public ImportExportSession exportSession(String sessionkey) { + // TODO Auto.generated method stub + return null; + } + @Override public List<Question> getSkillQuestionsForUsers(Session session) { // TODO Auto-generated method stub @@ -549,6 +555,12 @@ public class StubDatabaseDao implements IDatabaseDao { return null; } + @Override + public List<Question> getAllSkillQuestions(Session session) { + // TODO Auto-generated method stub + return null; + } + @Override public List<Answer> getAnswers(Question question, int piRound) { // TODO Auto-generated method stub