From 5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 22 Jul 2023 14:46:41 +0200 Subject: fixup! backend: support an incremental time bonus --- wrms.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wrms.go b/wrms.go index 6650ae3..f6784c8 100644 --- a/wrms.go +++ b/wrms.go @@ -440,10 +440,10 @@ func (wrms *Wrms) AdjustSongWeight(connId uuid.UUID, songUri string, vote string if _, ok := s.Downvotes[connId]; ok { delete(s.Downvotes, connId) - s.Weight += 2 + s.Weight += 2.0 llog.Debug("Flip downvote") } else { - s.Weight += 1 + s.Weight += 1.0 } s.Upvotes[connId] = struct{}{} @@ -457,9 +457,9 @@ func (wrms *Wrms) AdjustSongWeight(connId uuid.UUID, songUri string, vote string if _, ok := s.Upvotes[connId]; ok { delete(s.Upvotes, connId) llog.Debug("Flip upvote") - s.Weight -= 2 + s.Weight -= 2.0 } else { - s.Weight -= 1 + s.Weight -= 1.0 } s.Downvotes[connId] = struct{}{} @@ -467,11 +467,11 @@ func (wrms *Wrms) AdjustSongWeight(connId uuid.UUID, songUri string, vote string case "unvote": if _, ok := s.Downvotes[connId]; ok { delete(s.Downvotes, connId) - s.Weight += 1 + s.Weight += 1.0 } else if _, ok := s.Upvotes[connId]; ok { delete(s.Upvotes, connId) - s.Weight -= 1 + s.Weight -= 1.0 } else { llog.Error("Double unvote of song %s by connections %s", songUri, connId) return -- cgit v1.2.3