Skip to content
Snippets Groups Projects
Commit 33008507 authored by Christoph Thelen's avatar Christoph Thelen
Browse files

Merge of changes for #4026 and #4029.

parents 55358aec 6a19b0f6
No related merge requests found
...@@ -188,7 +188,12 @@ public class CouchDBDao implements IDatabaseDao { ...@@ -188,7 +188,12 @@ public class CouchDBDao implements IDatabaseDao {
} }
@Override @Override
public List<Question> getSkillQuestions(String session, String sort) { public List<Question> getSkillQuestions(String sessionKeyword, String sort) {
Session session = this.getSessionFromKeyword(sessionKeyword);
if (session == null) {
return null;
}
String viewName = ""; String viewName = "";
if(sort != null && sort.equals("text")) { if(sort != null && sort.equals("text")) {
viewName = "skill_question/by_session_sorted_by_subject_and_text"; viewName = "skill_question/by_session_sorted_by_subject_and_text";
...@@ -197,9 +202,9 @@ public class CouchDBDao implements IDatabaseDao { ...@@ -197,9 +202,9 @@ public class CouchDBDao implements IDatabaseDao {
} }
try { try {
View view = new View(viewName); View view = new View(viewName);
view.setStartKey("[" + URLEncoder.encode("\"" + session + "\"", "UTF-8") + "]"); view.setStartKey("[" + URLEncoder.encode("\"" + session.get_id() + "\"", "UTF-8") + "]");
view.setEndKey("[" + URLEncoder.encode("\"" + session + "\",{}", "UTF-8") + "]"); view.setEndKey("[" + URLEncoder.encode("\"" + session.get_id() + "\",{}", "UTF-8") + "]");
ViewResults questions = this.getDatabase().view(view); ViewResults questions = this.getDatabase().view(view);
if(questions == null || questions.isEmpty()) { if(questions == null || questions.isEmpty()) {
return null; return null;
......
...@@ -37,6 +37,8 @@ public class Question { ...@@ -37,6 +37,8 @@ public class Question {
private int number; private int number;
private int duration; private int duration;
private String _id;
private String _rev;
public String getType() { public String getType() {
...@@ -135,6 +137,22 @@ public class Question { ...@@ -135,6 +137,22 @@ public class Question {
this.duration = duration; this.duration = duration;
} }
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public String get_rev() {
return _rev;
}
public void set_rev(String _rev) {
this._rev = _rev;
}
@Override @Override
public String toString() { public String toString() {
return "Question type '" + this.questionType + "': " + this.subject + ";\n" + this.text + return "Question type '" + this.questionType + "': " + this.subject + ";\n" + this.text +
......
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