-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from aiarena/staging
Release v1.6.8
- Loading branch information
Showing
12 changed files
with
258 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 3.2.9 on 2022-03-09 11:48 | ||
|
||
import aiarena.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0045_auto_20220222_2343'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CompetitionBotMapStats', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('match_count', models.IntegerField(blank=True, null=True)), | ||
('win_count', models.IntegerField(blank=True, null=True)), | ||
('win_perc', models.FloatField(blank=True, null=True, validators=[aiarena.core.validators.validate_not_nan, aiarena.core.validators.validate_not_inf])), | ||
('loss_count', models.IntegerField(blank=True, null=True)), | ||
('loss_perc', models.FloatField(blank=True, null=True, validators=[aiarena.core.validators.validate_not_nan, aiarena.core.validators.validate_not_inf])), | ||
('tie_count', models.IntegerField(blank=True, null=True)), | ||
('tie_perc', models.FloatField(blank=True, null=True, validators=[aiarena.core.validators.validate_not_nan, aiarena.core.validators.validate_not_inf])), | ||
('crash_count', models.IntegerField(blank=True, null=True)), | ||
('crash_perc', models.FloatField(blank=True, null=True, validators=[aiarena.core.validators.validate_not_nan, aiarena.core.validators.validate_not_inf])), | ||
('updated', models.DateTimeField(default=django.utils.timezone.now)), | ||
('bot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='competition_map_stats', to='core.competitionparticipation')), | ||
('map', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.map')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
|
||
from django.db import models | ||
from django.utils import timezone | ||
from aiarena.core.validators import validate_not_nan, validate_not_inf | ||
from .competition_participation import CompetitionParticipation | ||
from .map import Map | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class CompetitionBotMapStats(models.Model): | ||
bot = models.ForeignKey(CompetitionParticipation, on_delete=models.CASCADE, related_name='competition_map_stats') | ||
map = models.ForeignKey(Map, on_delete=models.CASCADE) | ||
match_count = models.IntegerField(blank=True, null=True) | ||
win_count = models.IntegerField(blank=True, null=True) | ||
win_perc = models.FloatField(blank=True, null=True, validators=[validate_not_nan, validate_not_inf]) | ||
loss_count = models.IntegerField(blank=True, null=True) | ||
loss_perc = models.FloatField(blank=True, null=True, validators=[validate_not_nan, validate_not_inf]) | ||
tie_count = models.IntegerField(blank=True, null=True) | ||
tie_perc = models.FloatField(blank=True, null=True, validators=[validate_not_nan, validate_not_inf]) | ||
crash_count = models.IntegerField(blank=True, null=True) | ||
crash_perc = models.FloatField(blank=True, null=True, validators=[validate_not_nan, validate_not_inf]) | ||
updated = models.DateTimeField(default=timezone.now) # populate fields before first save | ||
|
||
def save(self, *args, **kwargs): | ||
# update time pre save | ||
self.updated = timezone.now() | ||
# now we call django's save protocol | ||
super(CompetitionBotMapStats, self).save(*args, **kwargs) | ||
|
||
def __str__(self): | ||
return str(self.bot) + ' on ' + str(self.map) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.