|
|
@@ -535,13 +535,16 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS |
|
|
|
//normalization |
|
|
|
for k, v := range userIndexMap { |
|
|
|
tmpResult := (v - minUserIndex) / (maxUserIndex - minUserIndex) |
|
|
|
if v == maxUserIndex { |
|
|
|
tmpResult = 0.99 |
|
|
|
} |
|
|
|
updateUserIndex(tableName, statictisSess, k, tmpResult) |
|
|
|
} |
|
|
|
log.Info("refresh data finished.tableName=" + tableName + " total record:" + fmt.Sprint(insertCount)) |
|
|
|
} |
|
|
|
|
|
|
|
func updateUserIndex(tableName string, statictisSess *xorm.Session, userId int64, userIndex float64) { |
|
|
|
updateSql := "UPDATE public." + tableName + " set user_index=" + fmt.Sprint(userIndex) + " where id=" + fmt.Sprint(userId) |
|
|
|
updateSql := "UPDATE public." + tableName + " set user_index=" + fmt.Sprint(userIndex*100) + " where id=" + fmt.Sprint(userId) |
|
|
|
statictisSess.Exec(updateSql) |
|
|
|
} |
|
|
|
|
|
|
|