From f5c704757bce4a351b955830e60089f052bc54b2 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <daniel.gerhardt@mni.thm.de> Date: Mon, 2 Jan 2017 17:26:44 +0100 Subject: [PATCH] Include additional counts for deleted data in statistics view Added count of deleted questions, answers and comments. --- src/main/resources/views/statistics | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/views/statistics b/src/main/resources/views/statistics index 3d3f80c..93aa131 100644 --- a/src/main/resources/views/statistics +++ b/src/main/resources/views/statistics @@ -3,8 +3,8 @@ "language":"javascript", "views":{ "statistics":{ - "map":"function(doc) {\n switch (doc.type) {\n case 'session':\n if (doc.active == 1) { emit('openSessions', 1); }\n else { emit('closedSessions', 1); }\n break;\n case 'skill_question':\n if (doc.questionType === 'flashcard') {\n emit('flashcards', 1);\n } else {\n if (doc.questionVariant === 'lecture') { emit('lectureQuestions', 1); }\n else if (doc.questionVariant === 'preparation') { emit('preparationQuestions', 1); }\n if (doc.piRound == 2) { emit('conceptQuestions', 1); }\n }\n break;\n case 'skill_question_answer':\n emit('answers', 1);\n break;\n case 'interposed_question':\n emit ('interposedQuestions', 1);\n break;\n }\n}", - "reduce":"_count" + "map":"function(doc) {\n switch (doc.type) {\n case 'session':\n if (doc.active == 1) { emit('openSessions', 1); }\n else { emit('closedSessions', 1); }\n break;\n case 'skill_question':\n if (doc.questionType === 'flashcard') {\n emit('flashcards', 1);\n } else {\n if (doc.questionVariant === 'lecture') { emit('lectureQuestions', 1); }\n else if (doc.questionVariant === 'preparation') { emit('preparationQuestions', 1); }\n if (doc.piRound == 2) { emit('conceptQuestions', 1); }\n }\n break;\n case 'skill_question_answer':\n emit('answers', 1);\n break;\n case 'interposed_question':\n emit ('interposedQuestions', 1);\n break;\n case 'log':\n if (doc.event === 'delete') {\n switch (doc.payload.type) {\n case 'session':\n emit('deletedSessions', doc.payload.sessionCount || 1);\n break;\n case 'question':\n emit('deletedQuestions', doc.payload.questionCount || 1);\n break;\n case 'answer':\n emit('deletedAnswers', doc.payload.answerCount || 1);\n break;\n case 'comment':\n emit('deletedComments', doc.payload.commentCount || 1);\n break;\n case 'user':\n emit('deletedUsers', 1);\n break;\n }\n }\n break;\n }\n}", + "reduce":"_sum" }, "unique_session_creators":{ "map":"function(doc) { if (doc.type === 'session') { emit(doc.creator, 1); } }", -- GitLab