X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=models%2Fcourse.js;h=748ab6c33f7c32ea62728b824a33012dc2fb79d3;hb=92a6f83096ec0f1a32a306fda21ab2d324a3a433;hp=631bab9016d765b32de5f09d2883f6c4695bf899;hpb=43828378be054cf3604b753e8d9ab24af911188f;p=qomet.git diff --git a/models/course.js b/models/course.js index 631bab9..748ab6c 100644 --- a/models/course.js +++ b/models/course.js @@ -1,5 +1,4 @@ const UserModel = require("../models/user"); -const AssessmentModel = require("../models/assessment"); const db = require("../utils/database"); const CourseModel = @@ -159,13 +158,16 @@ const CourseModel = CourseModel.getById(cid, (err,course) => { if (!!err || !course || !course.uid.equals(uid)) return cb({errmsg:"Not your course"},{}); - // 2) remove all associated assessments - AssessmentModel.removeGroup(cid, (err2,ret) => { - if (!!err) - return cb(err,{}); - // 3) remove course (with its students) - CourseModel.remove(cid, cb); - }); + // 2) remove all associated evaluations + db.evaluations.remove( + { cid: cid }, + (err2,ret) => { + if (!!err) + return cb(err,{}); + // 3) remove course (with its students) + CourseModel.remove(cid, cb); + } + ); }); }, }