diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-07-22 14:46:41 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-07-22 14:46:41 +0200 |
| commit | 5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2 (patch) | |
| tree | 884dc13ce6d7777079f60ac1c1f8a39471d09410 | |
| parent | a93c5826172f835db604a2646d470ecfd72484cf (diff) | |
| download | WRMS-5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2.tar.gz WRMS-5d6358d8cc26db520488d2c7fbea5dbaa9e9fbd2.zip | |
fixup! backend: support an incremental time bonus
| -rw-r--r-- | wrms.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 |
