Browse Source

年度数据中增加个人名次最好的周度数据

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/3481/head
zouap 2 years ago
parent
commit
a3d4a917d0
2 changed files with 21 additions and 1 deletions
  1. +2
    -0
      models/user_analysis_for_activity.go
  2. +19
    -1
      models/user_business_analysis.go

+ 2
- 0
models/user_analysis_for_activity.go View File

@@ -470,6 +470,8 @@ func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear {
bonusInfo := make(map[string]int)
bonusInfo["order"] = record[0]
bonusInfo["money"] = record[1]
bonusInfo["week"] = record[2]
bonusInfo["num"] = record[3]
bonusInfoJson, _ := json.Marshal(bonusInfo)
reList[0].WeekBonusData = string(bonusInfoJson)
}


+ 19
- 1
models/user_business_analysis.go View File

@@ -900,20 +900,27 @@ func getBonusWeekDataMap() map[int64][]int {
userId := getInt64Value(aLine[0])
order := getIntValue(aLine[2])
money := getIntValue(aLine[3])
week, num := getWeekAndNum(filenames[i])
//email := lines[2]
record, ok := bonusMap[userId]
if !ok {
record = make([]int, 2)
record = make([]int, 4)
record[0] = order
record[1] = money
record[2] = week
record[3] = num
bonusMap[userId] = record
} else {
if record[0] > order {
record[0] = order
record[1] = money
record[2] = week
record[3] = num
} else {
if record[0] == order && record[1] < money {
record[1] = money
record[2] = week
record[3] = num
}
}
}
@@ -924,6 +931,17 @@ func getBonusWeekDataMap() map[int64][]int {
return bonusMap
}

func getWeekAndNum(name string) (int, int) {
name = name[0 : len(name)-4]
tmp := strings.Split(name, "_")
if len(tmp) == 2 {
week := getIntValue(tmp[0])
num := getIntValue(tmp[1])
return week, num
}
return 0, 0
}

func getBonusMap() map[string]map[string]int {
bonusMap := make(map[string]map[string]int)
url := setting.RecommentRepoAddr + "bonus/record.txt"


Loading…
Cancel
Save