From 1b68e7c9d59c83c0b28897f442e8a8c1059f06fa Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Jul 2023 16:07:19 +0800 Subject: [PATCH] fixed: user rank project owner changed remove rank --- app/views/user_rank/_detail.json.jbuilder | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/views/user_rank/_detail.json.jbuilder b/app/views/user_rank/_detail.json.jbuilder index d6c5c23ae..cb6692e07 100644 --- a/app/views/user_rank/_detail.json.jbuilder +++ b/app/views/user_rank/_detail.json.jbuilder @@ -25,11 +25,17 @@ if popular_project.blank? json.project nil else popular_project_common = $redis_cache.hgetall("v2-project-common:#{popular_project[0]}") - json.project do - json.id popular_project[0] - json.name popular_project_common["name"] - json.identifier popular_project_common["identifier"] - json.description popular_project_common["description"] + if popular_project_common["owner_id"].to_s == item[0].to_s + json.project do + json.id popular_project[0] + json.name popular_project_common["name"] + json.identifier popular_project_common["identifier"] + json.description popular_project_common["description"] + end + else + # owner changed remove rank + $redis_cache.zrem("v2-user-project-rank:#{item[0]}", popular_project[0]) + json.project nil end end