This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch fix/1.2.1/user
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit 36827ebc6b2ccb7c4e67f306b31e572b6588ee0b
Author: LinkinStars <[email protected]>
AuthorDate: Tue Dec 5 14:44:06 2023 +0800

    fix(user): remove deleted user from ranking
---
 internal/service/user_service.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/service/user_service.go b/internal/service/user_service.go
index df740731..3ab57540 100644
--- a/internal/service/user_service.go
+++ b/internal/service/user_service.go
@@ -870,7 +870,7 @@ func (us *UserService) warpStatRankingResp(
                if stat.Rank <= 0 {
                        continue
                }
-               if userInfo := userInfoMapping[stat.UserID]; userInfo != nil {
+               if userInfo := userInfoMapping[stat.UserID]; userInfo != nil && 
userInfo.Status != entity.UserStatusDeleted {
                        resp.UsersWithTheMostReputation = 
append(resp.UsersWithTheMostReputation, &schema.UserRankingSimpleInfo{
                                Username:    userInfo.Username,
                                Rank:        stat.Rank,
@@ -883,7 +883,7 @@ func (us *UserService) warpStatRankingResp(
                if stat.VoteCount <= 0 {
                        continue
                }
-               if userInfo := userInfoMapping[stat.UserID]; userInfo != nil {
+               if userInfo := userInfoMapping[stat.UserID]; userInfo != nil && 
userInfo.Status != entity.UserStatusDeleted {
                        resp.UsersWithTheMostVote = 
append(resp.UsersWithTheMostVote, &schema.UserRankingSimpleInfo{
                                Username:    userInfo.Username,
                                VoteCount:   stat.VoteCount,
@@ -893,7 +893,7 @@ func (us *UserService) warpStatRankingResp(
                }
        }
        for _, rel := range userRoleRels {
-               if userInfo := userInfoMapping[rel.UserID]; userInfo != nil {
+               if userInfo := userInfoMapping[rel.UserID]; userInfo != nil && 
userInfo.Status != entity.UserStatusDeleted {
                        resp.Staffs = append(resp.Staffs, 
&schema.UserRankingSimpleInfo{
                                Username:    userInfo.Username,
                                Rank:        userInfo.Rank,

Reply via email to