'update'
authorBenjamin Auder <benjamin.auder@somewhere>
Mon, 26 Feb 2018 10:53:34 +0000 (11:53 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Mon, 26 Feb 2018 10:53:34 +0000 (11:53 +0100)
models/course.js
models/evaluation.js
public/javascripts/components/statements.js
views/course.pug

index cbe2c44..748ab6c 100644 (file)
@@ -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);
+                               }
+                       );
                });
        },
 }
index be5dbc2..8cf7e64 100644 (file)
@@ -260,14 +260,6 @@ const EvaluationModel =
                );
        },
 
-       removeGroup: function(cid, cb)
-       {
-               db.evaluations.remove(
-                       { cid: cid },
-                       cb
-               );
-       },
-
        /////////////////////
        // ADVANCED FUNCTIONS
 
index 65bab5f..0b8ef65 100644 (file)
@@ -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)
        <params> (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()
        </params>
+       <result>
+       let M = math.matrix([[7, x], [y, -3]]);
+       return math.det(M);
+       </result>
        <div>Calculer le déterminant de 
-       $$\begin{matrix}7 & x\\y & -3\end{matrix}$$</div>
+       $$\begin{matrix}7 & £x£\\£y£ & -3\end{matrix}$$</div>
        * ...
 
 + fixed + question time (syntax ?)
index 4e44ec7..2a3f549 100644 (file)
@@ -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