From d26b0e913debf398d554fa76e3c397f0d912698d Mon Sep 17 00:00:00 2001
From: Daniel Gerhardt <code@dgerhardt.net>
Date: Mon, 31 Oct 2016 13:05:20 +0100
Subject: [PATCH] Refactor and format code for 'statistics/statistics' view

---
 src/main/resources/views/statistics | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/resources/views/statistics b/src/main/resources/views/statistics
index 93db95e..58c9afa 100644
--- a/src/main/resources/views/statistics
+++ b/src/main/resources/views/statistics
@@ -3,7 +3,7 @@
 	"language":"javascript",
 	"views":{
 		"statistics":{
-			"map":"function(doc) { if (doc.type == 'session') { if (doc.active == 1) { emit('openSessions', 1); } else { emit('closedSessions', 1); } } if (doc.type == 'skill_question') { if (doc.questionVariant === 'lecture') { emit('lectureQuestions', 1); } else if (doc.questionVariant === 'preparation') { emit('preparationQuestions', 1); } if (doc.piRound == 2) { emit('conceptQuestions', 1); } } if (doc.type == 'skill_question_answer') { emit('answers', 1); } if (doc.type === 'interposed_question') { emit ('interposedQuestions', 1); } }",
+			"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.questionVariant === 'lecture') { emit('lectureQuestions', 1); }\n    else if (doc.questionVariant === 'preparation') { emit('preparationQuestions', 1); }\n    if (doc.piRound == 2) { emit('conceptQuestions', 1); }\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"
 		},
 		"unique_session_creators":{
-- 
GitLab