diff --git a/src/main/resources/couchdb/Answer.design.js b/src/main/resources/couchdb/Answer.design.js index 44d0a92f3b4ecf99a9bcfb878668bb2421f19847..b673dd79e65239ce900109944c3b4cdac15464e6 100644 --- a/src/main/resources/couchdb/Answer.design.js +++ b/src/main/resources/couchdb/Answer.design.js @@ -4,14 +4,14 @@ var designDoc = { "views": { "by_questionid": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit(doc.questionId, {_rev: doc._rev}); } } }, "by_questionid_piround_text_subject": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.questionId, doc.piRound, doc.abstention, doc.answerText, doc.answerSubject, doc.successfulFreeTextAnswer], {_rev: doc._rev}); } }, @@ -19,21 +19,21 @@ var designDoc = { }, "by_questionid_timestamp": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.questionId, doc.timestamp], {_rev: doc._rev}); } } }, "by_questionid_user_piround": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.questionId, doc.user, doc.piRound], {_rev: doc._rev}); } } }, "by_sessionid": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit(doc.sessionId, {_rev: doc._rev}); } }, @@ -41,7 +41,7 @@ var designDoc = { }, "by_sessionid_variant": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.sessionId, doc.questionVariant], {_rev: doc._rev}); } }, @@ -49,21 +49,21 @@ var designDoc = { }, "by_user_sessionid": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.user, doc.sessionId], {_rev: doc._rev}); } } }, "questionid_by_user_sessionid_variant": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.user, doc.sessionId, doc.questionVariant], doc.questionId); } } }, "questionid_piround_by_user_sessionid_variant": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit([doc.user, doc.sessionId, doc.questionVariant], [doc.questionId, doc.piRound]); } } diff --git a/src/main/resources/couchdb/Attachment.design.js b/src/main/resources/couchdb/Attachment.design.js index e19248f492d3ffbe15d44ff1386f64bd040b821c..38ae801438f75df56eeef226ff1592fa7f520c5a 100644 --- a/src/main/resources/couchdb/Attachment.design.js +++ b/src/main/resources/couchdb/Attachment.design.js @@ -4,7 +4,7 @@ var designDoc = { "views": { "by_creatorid": { "map": function (doc) { - if (doc.type === "attachment") { + if (doc.type === "Attachment") { emit(doc.creatorId, {_rev: doc._rev}); } }, diff --git a/src/main/resources/couchdb/Comment.design.js b/src/main/resources/couchdb/Comment.design.js index c407a2eb551f8c45f8f87c8efcdc69443d1affc1..5dcde26d162effbd55335cace2b3c5abff49c96d 100644 --- a/src/main/resources/couchdb/Comment.design.js +++ b/src/main/resources/couchdb/Comment.design.js @@ -4,7 +4,7 @@ var designDoc = { "views": { "by_sessionid": { "map": function (doc) { - if (doc.type === "interposed_question") { + if (doc.type === "Comment") { emit(doc.sessionId, {_rev: doc._rev}); } }, @@ -12,7 +12,7 @@ var designDoc = { }, "by_sessionid_creator_read": { "map": function (doc) { - if (doc.type === "interposed_question") { + if (doc.type === "Comment") { emit([doc.sessionId, doc.creator, doc.read], {_rev: doc._rev}) } }, @@ -20,14 +20,14 @@ var designDoc = { }, "by_sessionid_creator_timestamp": { "map": function (doc) { - if (doc.type === "interposed_question") { + if (doc.type === "Comment") { emit([doc.sessionId, doc.creator, doc.timestamp], {_rev: doc._rev}); } } }, "by_sessionid_read": { "map": function (doc) { - if (doc.type === "interposed_question") { + if (doc.type === "Comment") { emit([doc.sessionId, doc.read], {_rev: doc._rev}); } }, @@ -35,7 +35,7 @@ var designDoc = { }, "by_sessionid_timestamp": { "map": function (doc) { - if (doc.type === "interposed_question") { + if (doc.type === "Comment") { emit([doc.sessionId, doc.timestamp], {_rev: doc._rev}); } } diff --git a/src/main/resources/couchdb/Content.design.js b/src/main/resources/couchdb/Content.design.js index cb3f2f98208cb83b87d7d5b1183f43c969629c1f..6a827d2ac1f96d6f4ef4ac36b32dec3d890587ef 100644 --- a/src/main/resources/couchdb/Content.design.js +++ b/src/main/resources/couchdb/Content.design.js @@ -4,7 +4,7 @@ var designDoc = { "views": { "by_sessionid": { "map": function (doc) { - if (doc.type === "skill_question") { + if (doc.type === "Content") { emit(doc.sessionId, {_rev: doc._rev}); } }, @@ -12,7 +12,7 @@ var designDoc = { }, "by_sessionid_variant_active": { "map": function (doc) { - if (doc.type === "skill_question") { + if (doc.type === "Content") { emit([doc.sessionId, doc.questionVariant, doc.active, doc.subject, doc.text.substr(0, 16)], {_rev: doc._rev}); } }, diff --git a/src/main/resources/couchdb/LoggedIn.design.js b/src/main/resources/couchdb/LoggedIn.design.js deleted file mode 100644 index aadec2d1e364f8ef9b15defa43c75dae29f4ba68..0000000000000000000000000000000000000000 --- a/src/main/resources/couchdb/LoggedIn.design.js +++ /dev/null @@ -1,27 +0,0 @@ -var designDoc = { - "_id": "_design/LoggedIn", - "language": "javascript", - "views": { - "all": { - "map": function (doc) { - if (doc.type === "logged_in"){ - emit(doc.user, doc); - } - } - }, - "by_last_activity_for_guests": { - "map": function (doc) { - if (doc.type === "logged_in" && doc.user.indexOf("Guest") === 0) { - emit(doc.timestamp || 0, {_rev: doc._rev}); - } - } - }, - "visited_sessions_by_user": { - "map": function (doc) { - if (doc.type === "logged_in") { - emit(doc.user, doc.visitedSessions); - } - } - } - } -}; diff --git a/src/main/resources/couchdb/Motd.design.js b/src/main/resources/couchdb/Motd.design.js index 8e932510dc5ee7fddcae328058b636d1ae7ca2ac..f7aa01b86732b35e31334d8aa1eca55f3042a736 100644 --- a/src/main/resources/couchdb/Motd.design.js +++ b/src/main/resources/couchdb/Motd.design.js @@ -4,21 +4,21 @@ var designDoc = { "views": { "by_audience_for_global": { "map": function (doc) { - if (doc.type === "motd" && doc.audience !== "session") { + if (doc.type === "Motd" && doc.audience !== "session") { emit(doc.audience, {_rev: doc._rev}); } } }, "by_motdkey": { "map": function (doc) { - if (doc.type === "motd") { + if (doc.type === "Motd") { emit(doc.motdkey, {_rev: doc._rev}); } } }, "by_sessionkey": { "map": function (doc) { - if (doc.type === "motd" && doc.audience === "session") { + if (doc.type === "Motd" && doc.audience === "session") { emit(doc.sessionkey, {_rev: doc._rev}); } } diff --git a/src/main/resources/couchdb/MotdList.design.js b/src/main/resources/couchdb/MotdList.design.js deleted file mode 100644 index e7ddbe7621d93c89cb4b5ea2784369756452afe6..0000000000000000000000000000000000000000 --- a/src/main/resources/couchdb/MotdList.design.js +++ /dev/null @@ -1,13 +0,0 @@ -var designDoc = { - "_id": "_design/MotdList", - "language": "javascript", - "views": { - "doc_by_username": { - "map": function (doc) { - if (doc.type === "motdlist") { - emit(doc.username, doc); - } - } - } - } -}; diff --git a/src/main/resources/couchdb/Session.design.js b/src/main/resources/couchdb/Room.design.js similarity index 72% rename from src/main/resources/couchdb/Session.design.js rename to src/main/resources/couchdb/Room.design.js index 790e3af6afe0829abf1c2d177a6baa94acb2d390..8f29c860747b5fb91fc42cb413f5de625d770554 100644 --- a/src/main/resources/couchdb/Session.design.js +++ b/src/main/resources/couchdb/Room.design.js @@ -1,31 +1,31 @@ var designDoc = { - "_id": "_design/Session", + "_id": "_design/Room", "language": "javascript", "views": { "by_courseid": { "map": function (doc) { - if (doc.type === "session" && doc.courseId && doc.sessionType !== "public_pool") { + if (doc.type === "Room" && doc.courseId && doc.sessionType !== "public_pool") { emit(doc.courseId, {_rev: doc._rev}); } } }, "by_keyword": { "map": function (doc) { - if (doc.type === "session") { + if (doc.type === "Room") { emit(doc.keyword, {_rev: doc._rev}); } } }, "by_lastactivity_for_guests": { "map": function (doc) { - if (doc.type === "session" && doc.sessionType !== "public_pool" && doc.creator.indexOf("Guest") === 0) { + if (doc.type === "Room" && doc.sessionType !== "public_pool" && doc.creator.indexOf("Guest") === 0) { emit(doc.lastOwnerActivity || doc.creationTime, {_rev: doc._rev}); } } }, "partial_by_sessiontype_creator_name": { "map": function (doc) { - if (doc.type === "session") { + if (doc.type === "Room") { emit([doc.sessionType, doc.creator, doc.name], { shortName: doc.shortName, keyword: doc.keyword, @@ -38,7 +38,7 @@ var designDoc = { }, "partial_by_subject_name_for_publicpool": { "map": function (doc) { - if (doc.type === "session" && doc.sessiontype === "public_pool") { + if (doc.type === "Room" && doc.sessiontype === "public_pool") { emit([doc.ppSubject, doc.name], { ppSubject: doc.ppSubject, name: doc.name, diff --git a/src/main/resources/couchdb/DbUser.design.js b/src/main/resources/couchdb/UserProfile.design.js similarity index 61% rename from src/main/resources/couchdb/DbUser.design.js rename to src/main/resources/couchdb/UserProfile.design.js index aa63058d15eb951257a7e076ba2f8cb99a25bb15..07f37c3c21f9296d5d64b675d46cb4f365f55de0 100644 --- a/src/main/resources/couchdb/DbUser.design.js +++ b/src/main/resources/couchdb/UserProfile.design.js @@ -1,17 +1,17 @@ var designDoc = { - "_id": "_design/DbUser", + "_id": "_design/UserProfile", "language": "javascript", "views": { "by_creation_for_inactive": { "map": function (doc) { - if (doc.type === "userdetails" && doc.activationKey) { + if (doc.type === "UserProfile" && doc.activationKey) { emit(doc.creation, {_rev: doc._rev}); } } }, "by_username": { "map": function (doc) { - if (doc.type === "userdetails") emit(doc.username, {_rev: doc._rev}); + if (doc.type === "UserProfile") emit(doc.username, {_rev: doc._rev}); } } } diff --git a/src/main/resources/couchdb/lerning_progress.design.js b/src/main/resources/couchdb/lerning_progress.design.js index 5ae5ba8449748e938a7646a1863eb6314acf512f..716c6f78d3880628021b815c07b3c758d3b2a8f7 100644 --- a/src/main/resources/couchdb/lerning_progress.design.js +++ b/src/main/resources/couchdb/lerning_progress.design.js @@ -5,7 +5,7 @@ var designDoc = { "question_value_achieved_for_user": { "comment": "This view returns the points users scored for answered questions.", "map": function (doc) { - if (doc.type === "skill_question_answer" && !doc.abstention) { + if (doc.type === "Answer" && !doc.abstention) { /* The 'questionValue' contains the points scored with this answer, * and this could be negative if a wrong answer was given. * However, we do not want negative values, so we set the lower bound to 0.*/ @@ -28,7 +28,7 @@ var designDoc = { * 1) On any single choice question, the value is the maximum of all possibleAnswer values. * 2) On a multiple choice question, we add up all positive values. */ var value = 0, answers = [], positiveAnswers = [], score = 0; - if (doc.type === "skill_question" && ["school", "flashcard"].indexOf(doc.questionType) === -1) { + if (doc.type === "Content" && ["school", "flashcard"].indexOf(doc.questionType) === -1) { if ("freetext" === doc.questionType && !doc.fixedAnswer) { return; } answers = doc.possibleAnswers.map(function (answer) { return answer.value || 0; }); /* find the maximum value */ diff --git a/src/main/resources/couchdb/statistics.design.js b/src/main/resources/couchdb/statistics.design.js index c9004fd5432a16842d0e1bb25870977aa286daf2..0e33e1499363d9b0160f0905fb1647a4d6c6290a 100644 --- a/src/main/resources/couchdb/statistics.design.js +++ b/src/main/resources/couchdb/statistics.design.js @@ -4,7 +4,7 @@ var designDoc = { "views": { "active_student_users": { "map": function (doc) { - if (doc.type === "skill_question_answer") { + if (doc.type === "Answer") { emit(doc.user, 1); } }, @@ -13,14 +13,14 @@ var designDoc = { "statistics": { "map": function (doc) { switch (doc.type) { - case "session": + case "Room": if (doc.active) { emit("openSessions", 1); } else { emit("closedSessions", 1); } break; - case "skill_question": + case "Content": if (doc.questionType === "flashcard") { emit("flashcards", 1); } else { @@ -34,13 +34,13 @@ var designDoc = { } } break; - case "skill_question_answer": + case "Answer": emit("answers", 1); break; - case "interposed_question": + case "Comment": emit ("interposedQuestions", 1); break; - case "log": + case "LogEntry": if (doc.event === "delete") { switch (doc.payload.type) { case "session": @@ -67,7 +67,7 @@ var designDoc = { }, "unique_session_creators": { "map": function (doc) { - if (doc.type === "session") { + if (doc.type === "Room") { emit(doc.creator, 1); } },