From a9ddc31e97759aea654571806ea07468044040d5 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <daniel.gerhardt@mni.thm.de> Date: Thu, 30 Aug 2018 13:25:29 +0200 Subject: [PATCH] Cast successfulFreeTextAnswer to boolean `successfulFreeTextAnswer` can be `null` for old documents which causes problems for the backend which expects a boolean value as part of the key of `skill_question/count_all_answers_by_question`. --- src/main/resources/views/skill_question | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/views/skill_question b/src/main/resources/views/skill_question index 54f6ba7..5f1ff5b 100644 --- a/src/main/resources/views/skill_question +++ b/src/main/resources/views/skill_question @@ -46,7 +46,7 @@ "reduce": "_sum" }, "count_all_answers_by_question": { - "map": "function(doc) { if (doc.type == 'skill_question_answer') { emit([doc.questionId, doc.answerText, doc.answerSubject, doc.successfulFreeTextAnswer], 1); }}", + "map": "function(doc) { if (doc.type == 'skill_question_answer') { emit([doc.questionId, doc.answerText, doc.answerSubject, !!doc.successfulFreeTextAnswer], 1); }}", "reduce": "_sum" }, "count_total_answers_by_question_and_piround": { -- GitLab