aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-07-22 14:46:41 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-07-22 14:46:41 +0200
commit5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2 (patch)
tree884dc13ce6d7777079f60ac1c1f8a39471d09410
parenta93c5826172f835db604a2646d470ecfd72484cf (diff)
downloadWRMS-5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2.tar.gz
WRMS-5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2.zip
fixup! backend: support an incremental time bonus
-rw-r--r--wrms.go12
1 files 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