From 9843a388c3f0d891c720246c203c2701872b8177 Mon Sep 17 00:00:00 2001 From: Fedor Glazov Date: Fri, 25 Nov 2022 16:10:14 +0100 Subject: [PATCH] Make aircraft rating 64bit integer instead of 32 bit. An integer overflow can happen with 32 bits with a very good, dedicated player. It caused the stats procesing to crash. --- changelog.txt | 3 +++ .../aircraft_mod_models.py | 2 +- .../migrations/0010_fix_rating_crash.py | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/mod_stats_by_aircraft/migrations/0010_fix_rating_crash.py diff --git a/changelog.txt b/changelog.txt index 352971d..fa7dbc8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -147,3 +147,6 @@ Version 1.5.2 - Add no bombs/bombs filter to mosquito. +Version 1.5.3 + +- Fix bug where stats would crash if player aircraft rating got too high. \ No newline at end of file diff --git a/src/mod_stats_by_aircraft/aircraft_mod_models.py b/src/mod_stats_by_aircraft/aircraft_mod_models.py index 286a87f..111c3cd 100644 --- a/src/mod_stats_by_aircraft/aircraft_mod_models.py +++ b/src/mod_stats_by_aircraft/aircraft_mod_models.py @@ -82,7 +82,7 @@ class AircraftBucket(models.Model): plane_lethality = models.FloatField(default=0, db_index=True) pilot_lethality = models.FloatField(default=0, db_index=True) elo = models.IntegerField(default=1500, db_index=True) - rating = models.IntegerField(default=0, db_index=True) + rating = models.BigIntegerField(default=0, db_index=True) max_ak_streak = models.IntegerField(default=0, db_index=True) max_gk_streak = models.IntegerField(default=0, db_index=True) kills = models.BigIntegerField(default=0, db_index=True) diff --git a/src/mod_stats_by_aircraft/migrations/0010_fix_rating_crash.py b/src/mod_stats_by_aircraft/migrations/0010_fix_rating_crash.py new file mode 100644 index 0000000..a825b43 --- /dev/null +++ b/src/mod_stats_by_aircraft/migrations/0010_fix_rating_crash.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2022-11-25 15:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mod_stats_by_aircraft', '0009_fix_captures'), + ] + + operations = [ + migrations.AlterField( + model_name='aircraftbucket', + name='rating', + field=models.BigIntegerField(db_index=True, default=0), + ), + ]