* 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 fdbf819092
commit 0b2e040fc9
8 changed files with 3199 additions and 11 deletions

View File

@@ -21,8 +21,6 @@ def recalculate(modeladmin, request, queryset): # Ignore PyLintBear (W0613)
for ladder_ranking in queryset:
set_dirty(user=ladder_ranking.user_id,
season=ladder_ranking.season)
recalculate.short_description = _("Recalculate")

View File

@@ -56,7 +56,7 @@ def export_season_rankings(workbook, until):
def export_kyu_dan_rankings(workbook, until):
KyuDanRanking.objects.update(until=until)
KyuDanRanking.objects.update(until=until, force_recalc=True)
object_list = KyuDanRanking.objects.all()
title = "Kyū & Dan Rankings"
columns_settings = (

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

View File

@@ -240,7 +240,7 @@ class PlayerDanScore(PlayerScore):
{'col': 'L', 'title': 'Dan Punkte', 'attr': 'dan_points',
'style': 'Integer', 'width': 12,
'footer': self.kyu_dan_ranking.legacy_dan_points},
{'col': 'M', 'title': 'Anmerkung', 'attr': 'comment',
{'col': 'M', 'title': 'Anmerkung', 'attr': 'player_comment',
'style': 'Content', 'width': 20, 'footer': 'Legacy Dan Punkte'},
)