From: Benjamin Auder Date: Mon, 26 Feb 2018 10:53:34 +0000 (+0100) Subject: 'update' X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/doc/pieces/cr.svg?a=commitdiff_plain;h=92a6f83096ec0f1a32a306fda21ab2d324a3a433;p=qomet.git 'update' --- diff --git a/models/course.js b/models/course.js index cbe2c44..748ab6c 100644 --- a/models/course.js +++ b/models/course.js @@ -1,5 +1,4 @@ const UserModel = require("../models/user"); -const EvaluationModel = require("../models/evaluation"); const db = require("../utils/database"); const CourseModel = @@ -160,12 +159,15 @@ const CourseModel = if (!!err || !course || !course.uid.equals(uid)) return cb({errmsg:"Not your course"},{}); // 2) remove all associated evaluations - EvaluationModel.removeGroup(cid, (err2,ret) => { - if (!!err) - return cb(err,{}); - // 3) remove course (with its students) - CourseModel.remove(cid, cb); - }); + db.evaluations.remove( + { cid: cid }, + (err2,ret) => { + if (!!err) + return cb(err,{}); + // 3) remove course (with its students) + CourseModel.remove(cid, cb); + } + ); }); }, } diff --git a/models/evaluation.js b/models/evaluation.js index be5dbc2..8cf7e64 100644 --- a/models/evaluation.js +++ b/models/evaluation.js @@ -260,14 +260,6 @@ const EvaluationModel = ); }, - removeGroup: function(cid, cb) - { - db.evaluations.remove( - { cid: cid }, - cb - ); - }, - ///////////////////// // ADVANCED FUNCTIONS diff --git a/public/javascripts/components/statements.js b/public/javascripts/components/statements.js index 65bab5f..0b8ef65 100644 --- a/public/javascripts/components/statements.js +++ b/public/javascripts/components/statements.js @@ -6,13 +6,15 @@ NOTE: questions can contain parameterized exercises (how ? --> write javascript script (OK, users trusted ? ==> safe mode possible if public website) Imaginary example: (using math.js) (avant l'exo) - x: math.random() - y: math.random() - M: math.matrix([[7, x], [y, -3]]); - res: math.det(M) + const x = math.random() + const y = math.random() + + let M = math.matrix([[7, x], [y, -3]]); + return math.det(M); +
Calculer le déterminant de - $$\begin{matrix}7 & x\\y & -3\end{matrix}$$
+ $$\begin{matrix}7 & £x£\\£y£ & -3\end{matrix}$$ * ... + fixed + question time (syntax ?) diff --git a/views/course.pug b/views/course.pug index 4e44ec7..2a3f549 100644 --- a/views/course.pug +++ b/views/course.pug @@ -66,7 +66,7 @@ block content button.waves-effect.waves-light.btn(@click="redirect(evaluation.name)") View div .introduction(v-html="evaluation.introduction") - statements(:questions="evaluation.questions" :display="'solution'") + statements(:questions="evaluation.questions" :answers="evaluation.answers" :display="'solution'") .card(v-show="mode=='edit'") form(@submit.prevent) p