Skip to content
Snippets Groups Projects
Commit ff3d52d9 authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Fixed type and intended value of stubQuestions.get()

In getSkillQuestion() a call to stubQuestions.get() contained an argument
with an incompatible class. Session will be converted into String using
toString() but this is not what was intended to do here.

In saveQuestion() the CouchDB document ID was used, but the sessions
keyword should have been used instead.
parent aeac7188
No related merge requests found
......@@ -34,9 +34,9 @@ import de.thm.arsnova.entities.LoggedIn;
import de.thm.arsnova.entities.Question;
import de.thm.arsnova.entities.Session;
import de.thm.arsnova.entities.SessionInfo;
import de.thm.arsnova.entities.SortOrder;
import de.thm.arsnova.entities.Statistics;
import de.thm.arsnova.entities.User;
import de.thm.arsnova.entities.SortOrder;
import de.thm.arsnova.entities.transport.ImportExportSession;
import de.thm.arsnova.exceptions.NoContentException;
import de.thm.arsnova.exceptions.NotFoundException;
......@@ -126,7 +126,7 @@ public class StubDatabaseDao implements IDatabaseDao {
@Override
public Question saveQuestion(Session session, Question question) {
List<Question> questions = stubQuestions.get(session.get_id());
List<Question> questions = stubQuestions.get(session.getKeyword());
questions.add(question);
stubQuestions.put(session.get_id(), questions);
......@@ -141,11 +141,13 @@ public class StubDatabaseDao implements IDatabaseDao {
@Override
public List<Question> getSkillQuestions(User user, Session session) {
if (session == null)
if (session == null) {
throw new NotFoundException();
List<Question> questions = stubQuestions.get(session);
if (questions == null)
}
List<Question> questions = stubQuestions.get(session.getKeyword());
if (questions == null) {
throw new NoContentException();
}
return questions;
}
......@@ -245,12 +247,12 @@ public class StubDatabaseDao implements IDatabaseDao {
@Override
public InterposedQuestion getInterposedQuestion(String questionId) {
return this.interposedQuestion;
return interposedQuestion;
}
@Override
public void markInterposedQuestionAsRead(InterposedQuestion question) {
this.interposedQuestion.setRead(true);
interposedQuestion.setRead(true);
}
@Override
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment