Skip to content
Snippets Groups Projects
Commit 2176c312 authored by Andreas Gärtner's avatar Andreas Gärtner
Browse files

Add possibility to request question list with image data.

parent d6d4209d
No related merge requests found
......@@ -236,6 +236,7 @@ public class LecturerQuestionController extends PaginationController {
@RequestParam(value = "lecturequestionsonly", defaultValue = "false") final boolean lectureQuestionsOnly,
@RequestParam(value = "flashcardsonly", defaultValue = "false") final boolean flashcardsOnly,
@RequestParam(value = "preparationquestionsonly", defaultValue = "false") final boolean preparationQuestionsOnly,
@RequestParam(value = "requestImageData", defaultValue = "false") final boolean requestImageData,
final HttpServletResponse response
) {
List<Question> questions;
......@@ -251,6 +252,8 @@ public class LecturerQuestionController extends PaginationController {
if (questions == null || questions.isEmpty()) {
response.setStatus(HttpStatus.NO_CONTENT.value());
return null;
} else if (!requestImageData) {
questions = questionService.replaceImageData(questions);
}
return new PaginationListDecorator<Question>(questions, offset, limit);
......
......@@ -1641,10 +1641,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
question.setPiRound(1);
}
if (question.getImage() != null) {
question.setImage("true");
}
questions.add(question);
}
return questions;
......
......@@ -171,4 +171,6 @@ public interface IQuestionService {
String getQuestionFcImage(String questionId);
List<Question> replaceImageData(List<Question> questions);
}
......@@ -847,6 +847,18 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis
}
}
@Override
@PreAuthorize("isAuthenticated()")
public List<Question> replaceImageData(final List<Question> questions) {
for (Question q : questions) {
if (q.getImage() != null) {
q.setImage("true");
}
}
return questions;
}
private Session getSession(final String sessionkey) {
final Session session = databaseDao.getSessionFromKeyword(sessionkey);
if (session == null) {
......
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