go: discord/backend: Remove some bias from trust score calculation

master
Luther Wen Xu 2019-10-19 22:48:40 +07:00
parent 5b33e20640
commit b6feb6a0a2
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 3 additions and 1 deletions

@ -34,7 +34,9 @@ func GetTrust(s *discordgo.Session, discordID string) (float64, error) {
if err != nil { if err != nil {
return 0.0, err return 0.0, err
} }
votes = append(votes, 3) if len(votes) == 0 {
return 0.0, nil
}
var total float64 var total float64
for _, v := range votes { for _, v := range votes {
total += float64(v) total += float64(v)