* Kommentare wenn Dan/Kyu Punktabzüge verringert werden um nicht unter

0 zu fallen.
* Neue Middleware die REMOTE_IP aus dem X-Forward-For Header setzt.
  Damit funktioniert das Kommentarsystem nun auch hinter nginx.
This commit is contained in:
2017-12-29 10:03:08 +01:00
parent 10c27784ee
commit 192721452e
8 changed files with 3199 additions and 11 deletions

View File

@@ -566,11 +566,15 @@ class KyuDanRanking(models.Model):
if self.dan:
# Only substract so much points that player has 0 Points:
if self.dan_points + hanchan.dan_points < 0:
hanchan.player_comment = 'Spieler unterschreitet 0 Punkte.' \
'(Original {} Punkte)'.format(hanchan.dan_points)
hanchan.dan_points -= (self.dan_points + hanchan.dan_points)
self.dan_points += hanchan.dan_points
else:
# Only substract so much points that player has 0 Points:
if self.kyu_points + hanchan.kyu_points < 0:
hanchan.player_comment = 'Spieler unterschreitet 0 Punkte.' \
'(Original {} Punkte)'.format(hanchan.kyu_points)
hanchan.kyu_points -= (self.kyu_points + hanchan.kyu_points)
self.kyu_points += hanchan.kyu_points