Fix corr game rematch
[vchess.git] / server / models / Problem.js
index 9978d76..cc74006 100644 (file)
@@ -12,6 +12,7 @@ const db = require("../utils/database");
  */
 
 const ProblemModel = {
+
   checkProblem: function(p) {
     return (
       p.id.toString().match(/^[0-9]+$/) &&
@@ -81,14 +82,15 @@ const ProblemModel = {
 
   safeRemove: function(id, uid, devs) {
     db.serialize(function() {
-      let whereClause = "WHERE id = " + prob.id;
+      let whereClause = "WHERE id = " + id;
       if (!devs.includes(uid)) whereClause += " AND uid = " + uid;
       const query =
         "DELETE FROM Problems " +
         whereClause;
       db.run(query);
     });
-  },
-}
+  }
+
+};
 
 module.exports = ProblemModel;