From 52d5aa1708cc40701c93b26f90ece1376a4f7aaf Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 13 Jan 2023 18:11:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 8121f167c..07e87f7cc 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -922,6 +922,10 @@ func QueryUserLoginInfo(ctx *context.Context) { func QueryUserAnnualReport(ctx *context.Context) { log.Info("start to QueryUserAnnualReport ") - result := models.QueryUserAnnualReport(ctx.User.ID) - ctx.JSON(http.StatusOK, result) + if ctx.User == nil { + ctx.JSON(http.StatusOK, nil) + } else { + result := models.QueryUserAnnualReport(ctx.User.ID) + ctx.JSON(http.StatusOK, result) + } } From 1bba6a8fdefa060e51193f5ef3b97c83024207eb Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 09:37:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 4be8b9cf2..cb1970d23 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -842,9 +842,9 @@ func RefreshUserYearTable(pageStartTime time.Time, pageEndTime time.Time) { repoInfo := getRepoDetailInfo(DetailInfoMap, dateRecordAll.ID, MostDownloadMap) dataSetInfo, datasetscore := getDataSetInfo(dateRecordAll.ID, CreatedDataset, dataSetDownloadMap, CommitDatasetNumMap, CollectedDataset) scoreMap["datasetscore"] = datasetscore - codeInfo, codescore := getCodeInfo(dateRecordAll) + codeInfo, codescore := getCodeInfo(&dateRecordAll) scoreMap["codescore"] = codescore - cloudBrainInfo := getCloudBrainInfo(dateRecordAll, CloudBrainTaskItemMap, scoreMap) + cloudBrainInfo := getCloudBrainInfo(&dateRecordAll, CloudBrainTaskItemMap, scoreMap) playARoll := getPlayARoll(bonusMap, dateRecordAll.Name, scoreMap) re := &UserSummaryCurrentYear{ ID: dateRecordAll.ID, @@ -891,6 +891,8 @@ func getBonusWeekDataMap() map[int64][]int { if strings.HasSuffix(filenames[i], "\r") { filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] } + week, num := getWeekAndNum(filenames[i]) + log.Info("filenames[i]=" + filenames[i] + "week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { @@ -908,7 +910,6 @@ func getBonusWeekDataMap() map[int64][]int { userId := getInt64Value(aLine[0]) order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) - week, num := getWeekAndNum(filenames[i]) //log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) //email := lines[2] record, ok := bonusMap[userId] @@ -1028,7 +1029,7 @@ func getPlayARoll(bonusMap map[string]map[string]int, userName string, scoreMap } } -func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItemMap map[string]int, scoreMap map[string]float64) string { +func getCloudBrainInfo(dateRecordAll *UserBusinessAnalysisAll, CloudBrainTaskItemMap map[string]int, scoreMap map[string]float64) string { trainscore := 0.0 debugscore := 0.0 runtime := 0.0 @@ -1063,7 +1064,7 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem } } -func getCodeInfo(dateRecordAll UserBusinessAnalysisAll) (string, float64) { +func getCodeInfo(dateRecordAll *UserBusinessAnalysisAll) (string, float64) { if dateRecordAll.CommitCount > 0 { codeInfo := make(map[string]string) codeInfo["commit_count"] = fmt.Sprint(dateRecordAll.CommitCount) From c096dbf2d7d4ca9321b1631a6addd4da02c7ec76 Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 09:59:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E5=91=A8=E5=BA=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index cb1970d23..2a379095a 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -891,8 +891,6 @@ func getBonusWeekDataMap() map[int64][]int { if strings.HasSuffix(filenames[i], "\r") { filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] } - week, num := getWeekAndNum(filenames[i]) - log.Info("filenames[i]=" + filenames[i] + "week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { @@ -910,6 +908,7 @@ func getBonusWeekDataMap() map[int64][]int { userId := getInt64Value(aLine[0]) order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) + week, num := getWeekAndNum(filenames[i]) //log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) //email := lines[2] record, ok := bonusMap[userId] From afc362d047457daa008309d2dbf2470e5c0b15aa Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 10:01:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E9=83=A8=E5=88=86?= =?UTF-8?q?=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 --- routers/repo/user_data_analysis.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 07e87f7cc..8121f167c 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -922,10 +922,6 @@ func QueryUserLoginInfo(ctx *context.Context) { func QueryUserAnnualReport(ctx *context.Context) { log.Info("start to QueryUserAnnualReport ") - if ctx.User == nil { - ctx.JSON(http.StatusOK, nil) - } else { - result := models.QueryUserAnnualReport(ctx.User.ID) - ctx.JSON(http.StatusOK, result) - } + result := models.QueryUserAnnualReport(ctx.User.ID) + ctx.JSON(http.StatusOK, result) }