From 6a2b296825f08015f35e537de96d5e663ea7c135 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 15 Nov 2021 11:07:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/custom_migrations.go | 5 +++-- models/user_business_analysis.go | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/models/custom_migrations.go b/models/custom_migrations.go index 9cb0545b7..0bd52da67 100644 --- a/models/custom_migrations.go +++ b/models/custom_migrations.go @@ -14,10 +14,11 @@ type CustomMigration struct { var customMigrations = []CustomMigration{ {"Custom v1 Topic struct change to support chinese", syncTopicStruct}, - {"Delete zuzhi user history data ", deleteNotDisplayUser}, } -var customMigrationsStatic = []CustomMigration{} +var customMigrationsStatic = []CustomMigration{ + {"Delete zuzhi user history data ", deleteNotDisplayUser}, +} func MigrateCustom(x *xorm.Engine) { diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index ee5f2ccfb..ac51c2816 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -578,7 +578,7 @@ func queryUserRepoOpenIIndex(start_unix int64, end_unix int64) map[int64]float64 log.Info("query Repository size=" + fmt.Sprint(len(repoList))) for _, repoRecord := range repoList { if _, ok := userMap[repoRecord.OwnerID]; !ok { - if _, ok := repoOpenIIndexMap[repoRecord.ID]; !ok { + if _, ok := repoOpenIIndexMap[repoRecord.ID]; ok { userMap[repoRecord.OwnerID] = repoOpenIIndexMap[repoRecord.ID] } } @@ -588,13 +588,16 @@ func queryUserRepoOpenIIndex(start_unix int64, end_unix int64) map[int64]float64 sess.Select("repo_id,user_id,mode").Table("collaboration") collaborationList := make([]*Collaboration, 0) sess.Find(&collaborationList) + + log.Info("query collaborationList size=" + fmt.Sprint(len(collaborationList))) + for _, collaborationRecord := range collaborationList { if _, ok := userMap[collaborationRecord.UserID]; !ok { - if _, ok := repoOpenIIndexMap[collaborationRecord.RepoID]; !ok { + if _, ok := repoOpenIIndexMap[collaborationRecord.RepoID]; ok { userMap[collaborationRecord.UserID] = repoOpenIIndexMap[collaborationRecord.RepoID] } } else { - if _, ok := repoOpenIIndexMap[collaborationRecord.RepoID]; !ok { + if _, ok := repoOpenIIndexMap[collaborationRecord.RepoID]; ok { userMap[collaborationRecord.UserID] += repoOpenIIndexMap[collaborationRecord.RepoID] } }