You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Judger side's rating function is not working as expect.
Step to fix it
The addJudgers function was invoked incorrectly.
origin code
// controller/judger.js, from line 122 to 132judger.post('*/rate/save/:id/',async(ctx,next)=>{letrate=Number.parseInt(ctx.request.fields.rate);if(Number.isInteger(rate)===false||rate<1||rate>10){ctx.body={status: "error",data: "评分必须是整数并且在1到10之间"};return;}letteamInfo=awaitctx.db.Team.findById(ctx.params.id);teamInfo.addJudgers(ctx.session.id,{rate: ctx.request.fields.rate});ctx.body={status: "success"};});
fixed code
// controller/judger.jsjudger.post('*/rate/save/:id/',async(ctx,next)=>{letrate=Number.parseInt(ctx.request.fields.rate);if(Number.isInteger(rate)===false||rate<1||rate>10){ctx.body={status: "error",data: "评分必须是整数并且在1到10之间"};return;}letteamInfo=awaitctx.db.Team.findById(ctx.params.id);// the following line has been changed ⬇️teamInfo.addJudgers(ctx.session.id,{through: {rate: rate}});ctx.body={status: "success"};});
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
report a bug
What is the current behavior?
Judger side's rating function is not working as expect.
Step to fix it
The
addJudgers
function was invoked incorrectly.origin code
fixed code
The text was updated successfully, but these errors were encountered: