Skip to content

Commit

Permalink
fix out of range value at update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JianShan-1214 authored and fanlan1210 committed Sep 22, 2021
1 parent 8a83f35 commit 932a958
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions controllers/courses_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,17 @@ module.exports = class Courses {
let rateHW = req.body.作業量;
let rateLN = req.body.豐富度;
let rateRD = req.body.推薦度;
if (rateHW===undefined) rateHW=0
if (rateLN===undefined) rateLN=0
if (rateRD===undefined ) rateRD=0
if (rateHW===undefined || rateLN===undefined || rateRD===undefined ||
!(
1 <= rateHW &&
rateHW <= 5 &&
1 <= rateLN &&
rateLN <= 5 &&
1 <= rateRD &&
rateRD <= 5
)){
res.send("不要亂玩server")
}
let findObj = {
teacher: req.params.teacher,
subject: req.params.subject,
Expand Down

0 comments on commit 932a958

Please sign in to comment.