Refactor value calculation in MusicGameOrder to improve scoring logic
Fix #13 Close #12
This commit is contained in:
parent
c639307cfb
commit
84c432c325
1 changed files with 4 additions and 7 deletions
|
@ -121,13 +121,10 @@ class MusicGameOrder(models.Model):
|
|||
value = models.PositiveIntegerField(default=0)
|
||||
|
||||
def update_value(self):
|
||||
n_right = self.musicgameanswer_set.filter(game__player=F("answer")).count()
|
||||
if n_right == 0:
|
||||
self.value = 1000
|
||||
else:
|
||||
self.value = 1000 / (
|
||||
1 + ((n_right - 1) / (self.game.players.count() - 1)) ** 0.5
|
||||
)
|
||||
x = self.musicgameanswer_set.filter(game__player=F("answer")).count()
|
||||
n = self.game.players.count()
|
||||
n = max(3, n)
|
||||
self.value = 1000 * 2 ** (-(x - 2) / (n - 2))
|
||||
self.save()
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue