From db525fd7c88564fe0c49e1e6e20edd602565bd83 Mon Sep 17 00:00:00 2001 From: Menci Date: Thu, 15 Dec 2016 17:42:10 +0800 Subject: [PATCH] Fix bug of counting AC and submit --- models/user.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/models/user.js b/models/user.js index 621493a..f366cdb 100644 --- a/models/user.js +++ b/models/user.js @@ -91,7 +91,10 @@ class User extends Model { attributes: ['problem_id'], where: { user_id: this.id, - status: 'Accepted' + status: 'Accepted', + type: { + $ne: 1 // Not a contest submissio + } } }); @@ -100,7 +103,10 @@ class User extends Model { this.ac_num = s.size; let cnt = await JudgeState.count({ - user_id: this.id + user_id: this.id, + type: { + $ne: 1 // Not a contest submissio + } }); this.submit_num = cnt; @@ -113,7 +119,10 @@ class User extends Model { attributes: ['problem_id'], where: { user_id: this.id, - status: 'Accepted' + status: 'Accepted', + type: { + $ne: 1 // Not a contest submissio + } } });