Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
ARSnova Backend
Commits
62fa5edc
Commit
62fa5edc
authored
11 years ago
by
Christoph Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Handle empty responses properly
parent
75ca05d7
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+2
-2
2 additions, 2 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
src/main/java/de/thm/arsnova/services/QuestionService.java
+5
-1
5 additions, 1 deletion
src/main/java/de/thm/arsnova/services/QuestionService.java
with
7 additions
and
3 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+
2
−
2
View file @
62fa5edc
...
...
@@ -1007,13 +1007,13 @@ public class CouchDBDao implements IDatabaseDao {
@Override
public
List
<
Answer
>
getFreetextAnswers
(
String
questionId
)
{
try
{
List
<
Answer
>
answers
=
new
ArrayList
<
Answer
>();
View
view
=
new
View
(
"skill_question/freetext_answers_full"
);
view
.
setKey
(
URLEncoder
.
encode
(
"\""
+
questionId
+
"\""
,
"UTF-8"
));
ViewResults
results
=
this
.
getDatabase
().
view
(
view
);
if
(
results
.
getResults
().
isEmpty
())
{
throw
new
NotFoundException
()
;
return
answers
;
}
List
<
Answer
>
answers
=
new
ArrayList
<
Answer
>();
for
(
Document
d
:
results
.
getResults
())
{
Answer
a
=
(
Answer
)
JSONObject
.
toBean
(
d
.
getJSONObject
().
getJSONObject
(
"value"
),
Answer
.
class
);
a
.
setQuestionId
(
questionId
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/services/QuestionService.java
+
5
−
1
View file @
62fa5edc
...
...
@@ -229,7 +229,11 @@ public class QuestionService implements IQuestionService {
@Override
@Authenticated
public
List
<
Answer
>
getFreetextAnswers
(
String
questionId
)
{
return
databaseDao
.
getFreetextAnswers
(
questionId
);
List
<
Answer
>
answers
=
databaseDao
.
getFreetextAnswers
(
questionId
);
if
(
answers
==
null
)
{
throw
new
NotFoundException
();
}
return
answers
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment