From 4722ac693f8952d18fd8104a5e3495f9b276f9f9 Mon Sep 17 00:00:00 2001 From: tekay <tom.kaesler@mni.thm.de> Date: Wed, 4 Mar 2015 16:09:16 +0100 Subject: [PATCH] #14875 first realisation of the new saveQuestion --- src/main/java/de/thm/arsnova/dao/CouchDBDao.java | 1 + src/main/java/de/thm/arsnova/entities/Question.java | 6 +++--- .../java/de/thm/arsnova/services/QuestionService.java | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java index d1ab8cd6..0872a35e 100644 --- a/src/main/java/de/thm/arsnova/dao/CouchDBDao.java +++ b/src/main/java/de/thm/arsnova/dao/CouchDBDao.java @@ -549,6 +549,7 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware q.put("gridType", question.getGridType()); q.put("scaleFactor", question.getScaleFactor()); q.put("gridScaleFactor", question.getGridScaleFactor()); + q.put("sequenceNr", question.getSequenceNr()); return q; } diff --git a/src/main/java/de/thm/arsnova/entities/Question.java b/src/main/java/de/thm/arsnova/entities/Question.java index fe571d92..ffbbf710 100644 --- a/src/main/java/de/thm/arsnova/entities/Question.java +++ b/src/main/java/de/thm/arsnova/entities/Question.java @@ -70,7 +70,7 @@ public class Question { private String gridType; private String scaleFactor; private String gridScaleFactor; - private int sequenceNr; + private int sequenceNo; public final String getType() { return type; @@ -444,8 +444,8 @@ public class Question { this.sequenceNr = sequenceNr; } - public int getSequenceNr() { - return this.sequenceNr; + public int getSequenceNo() { + return sequenceNr; } @Override diff --git a/src/main/java/de/thm/arsnova/services/QuestionService.java b/src/main/java/de/thm/arsnova/services/QuestionService.java index 535bd5a3..b2f5f393 100644 --- a/src/main/java/de/thm/arsnova/services/QuestionService.java +++ b/src/main/java/de/thm/arsnova/services/QuestionService.java @@ -114,6 +114,17 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis } else if (question.getPiRound() < 1 || question.getPiRound() > 2) { question.setPiRound(1); } + + // if SortIndex false, list is sorted so new question is appended to sorted list with (highest sequenceNr)++ + if ("lecture".equals(question.getQuestionVariant()) { + if(session.getSortLectureQuestions()) { + question.setSequenceNr(); + } + } else if ("preparation".equals(question.getQuestionVariant()) { + if(session.getSortPreparationQuestions()) { + question.setSequenceNr(); + } + } // convert imageurl to base64 if neccessary if ("grid".equals(question.getQuestionType())) { -- GitLab