From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 13 Feb 2018 00:24:33 +0000 (+0100)
Subject: Remove conclusion option in assessments (seems useless)
X-Git-Url: https://git.auder.net/variants/Chakart/%7B%7B%20path%28%27fos_user_change_password%27%29%20%7D%7D?a=commitdiff_plain;h=db5571d67f6b6b3b841fa1eeaf2099cecf2bcffc;p=qomet.git

Remove conclusion option in assessments (seems useless)
---

diff --git a/entities/assessment.js b/entities/assessment.js
index 3dc1952..b4b6d89 100644
--- a/entities/assessment.js
+++ b/entities/assessment.js
@@ -13,7 +13,6 @@ const AssessmentEntity =
 	 *   display: "one" or "all" (generally "all" for open questions, but...)
 	 *   time: 0, //<=0 means "untimed"; otherwise, time in seconds
 	 *   introduction: "",
-	 *   conclusion: "https://www.youtube.com/watch?v=6-9AjToJYuw",
 	 *   coefficient: number, default 1
 	 *   questions: array of
 	 *     index: for paper test, like 2.1.a (?!); and quiz: 0, 1, 2, 3...
@@ -21,7 +20,7 @@ const AssessmentEntity =
 	 *     options: array of varchar --> if present, question type == quiz!
 	 *     fixed: bool, options in fixed order (default: false)
 	 *     answer: array of integers (for quiz) or html text (for paper); striped in exam mode
-	 *     active: boolean, is question in current assessment? --> striped if inactive!
+	 *     active: boolean, is question in current assessment?
 	 *     points: points for this question (default 1)
 	 *   papers : array of
 	 *     number: student number
@@ -63,7 +62,6 @@ const AssessmentEntity =
 				display: "one",
 				time: 0,
 				introduction: "",
-				conclusion: "",
 				coefficient: 1,
 				questions: [ ],
 				papers: [ ],
@@ -239,17 +237,6 @@ const AssessmentEntity =
 		);
 	},
 
-	getConclusion: function(aid, callback)
-	{
-		db.assessments.findOne(
-			{ _id: aid },
-			{ conclusion: 1},
-			(err,res) => {
-				callback(err, !!res ? res.conclusion : null);
-			}
-		);
-	},
-
 	remove: function(aid, cb)
 	{
 		db.assessments.remove(
diff --git a/models/assessment.js b/models/assessment.js
index 65d594b..8bc08d5 100644
--- a/models/assessment.js
+++ b/models/assessment.js
@@ -132,9 +132,6 @@ const AssessmentModel =
 		AssessmentEntity.endAssessment(aid, number, password, (err,ret) => {
 			if (!!err || !ret)
 				return cb(err,ret);
-			AssessmentEntity.getConclusion(aid, (err2,conclusion) => {
-				cb(err2, {conclusion:conclusion});
-			});
 		});
 	},
 };
diff --git a/public/javascripts/assessment.js b/public/javascripts/assessment.js
index 342e963..95cd4d7 100644
--- a/public/javascripts/assessment.js
+++ b/public/javascripts/assessment.js
@@ -274,7 +274,6 @@ new Vue({
 				success: ret => {
 					if (!!ret.errmsg)
 						return this.showWarning(ret.errmsg);
-					assessment.conclusion = ret.conclusion;
 					this.stage = 3;
 					delete this.student["password"]; //unable to send new answers now
 				},
diff --git a/public/javascripts/utils/validation.js b/public/javascripts/utils/validation.js
index 530713a..625fb42 100644
--- a/public/javascripts/utils/validation.js
+++ b/public/javascripts/utils/validation.js
@@ -42,7 +42,6 @@ Validator.Assessment = {
 	"display": "alphanumeric", //"one" or "all"
 	"time": "integer",
 	"introduction": "string",
-	"conclusion": "string",
 	"coefficient": "number",
 	"questions": Validator.Question,
 	"papers": Validator.Paper,
diff --git a/public/stylesheets/assessment.css b/public/stylesheets/assessment.css
index 7677063..1baab9c 100644
--- a/public/stylesheets/assessment.css
+++ b/public/stylesheets/assessment.css
@@ -47,10 +47,6 @@ button.sendAnswer {
 	padding: 20px 5px;
 }
 
-.conclusion {
-	padding: 20px 5px;
-}
-
 .timer {
 	font-size: 2rem;
 }
diff --git a/public/stylesheets/course.css b/public/stylesheets/course.css
index 178e824..20c9527 100644
--- a/public/stylesheets/course.css
+++ b/public/stylesheets/course.css
@@ -57,10 +57,6 @@ tr.stats {
 	margin-top: 20px;
 }
 
-.conclusion {
-	margin-bottom: 20px;
-}
-
 table.in-question {
 	border: 1px solid black;
 	width: auto;
diff --git a/public/stylesheets/monitor.css b/public/stylesheets/monitor.css
index 303d68e..20406b3 100644
--- a/public/stylesheets/monitor.css
+++ b/public/stylesheets/monitor.css
@@ -38,9 +38,6 @@
 .introduction {
 	padding: 20px 5px;
 }
-.conclusion {
-	padding: 20px 5px;
-}
 table.in-question {
 	border: 1px solid black;
 	width: auto;
diff --git a/routes/assessments.js b/routes/assessments.js
index b7dcfd9..c1a99cf 100644
--- a/routes/assessments.js
+++ b/routes/assessments.js
@@ -37,7 +37,6 @@ router.post("/update/assessment", access.ajax, access.logged, (req,res) => {
 	if (error.length > 0)
 		return res.json({errmsg:error});
 	assessment.introduction = sanitizeHtml(assessment.introduction, sanitizeOpts);
-	assessment.conclusion = sanitizeHtml(assessment.conclusion, sanitizeOpts);
 	assessment.questions.forEach( q => {
 		q.wording = sanitizeHtml(q.wording, sanitizeOpts);
 		//q.answer = sanitizeHtml(q.answer); //if text (TODO: it's an array in this case?!)
@@ -119,11 +118,11 @@ router.get("/end/assessment", access.ajax, (req,res) => {
 	let error = validator({ _id:aid, papers:[{number:number,password:password}] }, "Assessment");
 	if (error.length > 0)
 		return res.json({errmsg:error});
-	// Destroy pwd, set endTime, return conclusion
-	AssessmentModel.endSession(ObjectId(aid), number, password, (err,conclusion) => {
-		access.checkRequest(res,err,conclusion,"Cannot end assessment", () => {
+	// Destroy pwd, set endTime
+	AssessmentModel.endSession(ObjectId(aid), number, password, (err,ret) => {
+		access.checkRequest(res,err,ret,"Cannot end assessment", () => {
 			res.clearCookie('password');
-			res.json(conclusion);
+			res.json({});
 		});
 	});
 });
diff --git a/routes/pages.js b/routes/pages.js
index f6c77a2..a78ba0d 100644
--- a/routes/pages.js
+++ b/routes/pages.js
@@ -114,8 +114,7 @@ router.get("/:initials([a-z0-9]+)/:courseCode([a-z0-9._-]+)/:assessmentName([a-z
 					// Basic headless browser detection
 					return res.json({errmsg: "Headless browser detected"});
 				}
-				// Strip conclusion + questions if exam mode (stepwise process)
-				delete assessment["conclusion"];
+				// Strip questions if exam mode (stepwise process)
 				delete assessment["questions"];
 			}
 			res.render("assessment", {
diff --git a/views/assessment.pug b/views/assessment.pug
index 9e8550f..87d9fba 100644
--- a/views/assessment.pug
+++ b/views/assessment.pug
@@ -51,9 +51,6 @@ block content
 				#stage3(v-show="stage==3")
 					.card
 						.finish Exam completed &#9786; ...don't close the window!
-				#stage3_4(v-show="[3,4].includes(stage)")
-					.card
-						.conclusion(v-html="assessment.conclusion")
 
 block append javascripts
 	script.
diff --git a/views/course.pug b/views/course.pug
index 8d2dce4..87788e3 100644
--- a/views/course.pug
+++ b/views/course.pug
@@ -56,9 +56,6 @@ block content
 						.input-field
 							textarea#assessmentEdition.materialize-textarea(v-model="assessmentText")
 							label(for="assessmentEdition") Assessment in text format
-						.input-field
-							textarea#conclusion.materialize-textarea(v-model="assessment.conclusion")
-							label(for="conclusion") Conclusion
 				.modal-footer
 					.center-align
 						a.modal-action.modal-close.waves-effect.waves-light.btn-flat(href="#!") Done
@@ -179,7 +176,6 @@ block content
 									label.on-left(:for="checkBoxFixedId(i)") Fixed
 									input(:id="checkBoxActiveId(i)" type="checkbox" v-model="question.active")
 									label(:for="checkBoxActiveId(i)") Active
-							.conclusion(v-html="assessment.conclusion")
 						.center-align
 							button.waves-effect.waves-light.btn.on-left(@click="mode='view'") Cancel
 							button.waves-effect.waves-light.btn(@click="updateAssessment") Send
diff --git a/views/grading.pug b/views/grading.pug
index f7eda27..5a0abf4 100644
--- a/views/grading.pug
+++ b/views/grading.pug
@@ -28,8 +28,6 @@ block content
 						.introduction(v-html="assessment.introduction")
 					.card
 						statements(:questions="assessment.questions" :answers:"answers")
-					.card
-						.conclusion(v-html="assessment.conclusion")
 
 block append javascripts
 	script.
diff --git a/views/monitor.pug b/views/monitor.pug
index fa9daee..7b257ec 100644
--- a/views/monitor.pug
+++ b/views/monitor.pug
@@ -39,8 +39,6 @@ block content
 							.introduction(v-html="assessment.introduction")
 						.card
 							statements(:questions="assessment.questions" :answers="answers")
-						.card
-							.conclusion(v-html="assessment.conclusion")
 
 block append javascripts
 	script.