This commit is contained in:
Theouche 2024-07-31 15:56:50 +02:00
parent 41c10ffe13
commit 80be17119a
4 changed files with 2 additions and 109 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.7 on 2024-07-30 19:44 # Generated by Django 5.0.7 on 2024-07-31 13:42
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
@ -48,7 +48,7 @@ class Migration(migrations.Migration):
('score_player2', models.PositiveSmallIntegerField()), ('score_player2', models.PositiveSmallIntegerField()),
('nbr_ball_touch_p1', models.PositiveIntegerField()), ('nbr_ball_touch_p1', models.PositiveIntegerField()),
('nbr_ball_touch_p2', models.PositiveIntegerField()), ('nbr_ball_touch_p2', models.PositiveIntegerField()),
('duration', models.DurationField()), ('duration', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
('date', models.DateField(auto_now_add=True)), ('date', models.DateField(auto_now_add=True)),
('is_tournoi', models.BooleanField()), ('is_tournoi', models.BooleanField()),
('player1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='match_as_player1', to='game.player')), ('player1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='match_as_player1', to='game.player')),

View File

@ -1,18 +0,0 @@
# Generated by Django 5.0.7 on 2024-07-31 13:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='match',
name='duration',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
]

View File

@ -1,68 +0,0 @@
# Generated by Django 5.0.7 on 2024-07-24 16:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='player',
name='best_score',
field=models.PositiveSmallIntegerField(default=0),
),
migrations.AddField(
model_name='player',
name='m_duration',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
migrations.AddField(
model_name='player',
name='m_nbr_ball_touch',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
migrations.AddField(
model_name='player',
name='m_score_adv_match',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
migrations.AddField(
model_name='player',
name='m_score_match',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
migrations.AddField(
model_name='player',
name='num_participated_tournaments',
field=models.PositiveSmallIntegerField(default=0),
),
migrations.AddField(
model_name='player',
name='num_won_tournaments',
field=models.PositiveSmallIntegerField(default=0),
),
migrations.AddField(
model_name='player',
name='p_win',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
),
migrations.AddField(
model_name='player',
name='total_duration',
field=models.DurationField(blank=True, null=True),
),
migrations.AddField(
model_name='player',
name='total_match',
field=models.PositiveSmallIntegerField(default=0),
),
migrations.AddField(
model_name='player',
name='total_win',
field=models.PositiveSmallIntegerField(default=0),
),
]

View File

@ -3,26 +3,6 @@ from django.core.exceptions import ValidationError
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.db.models import Max, Sum, F from django.db.models import Max, Sum, F
from datetime import timedelta from datetime import timedelta
<<<<<<< HEAD
def endfortheouche(p1, p2, s_p1, s_p2, winner, bt_p1, bt_p2, dur, is_tournoi, name_tournament) :
#If he doesn't exist, create player p1
if not Player.objects.filter(name=p1).exist():
create_player(p1)
#If he doesn't exist, create player p2
if not Player.objects.filter(name=p2).exist():
create_player(p2)
#create Match
create_match(p1, p2, s_p1, s_p2, bt_p1, bt_p2, dur, is_tournoi, name_tournamenttournoi)
#Update data p1 et p2
uptdate_player_statistics(p1)
uptdate_player_statistics(p2)
=======
from channels.db import database_sync_to_async from channels.db import database_sync_to_async
async def endfortheouche(p1, p2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tournament): async def endfortheouche(p1, p2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tournament):
@ -46,7 +26,6 @@ async def endfortheouche(p1, p2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_
await uptdate_player_statistics(p2) await uptdate_player_statistics(p2)
@database_sync_to_async @database_sync_to_async
>>>>>>> 067f24f5b87b0db75b90d5a86f47b30d1509ba99
def create_player( def create_player(
name, name,
total_match=0, total_match=0,