Add playtime and end_time columns

master
John Montagu, the 4th Earl of Sandvich 2024-10-25 17:32:43 -07:00
parent 849b628130
commit 280e02c15a
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,31 @@
# Generated by Django 5.1.2 on 2024-10-26 00:32
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_remove_playermasteravailability_unique_master_availability_and_more'),
]
operations = [
migrations.AddField(
model_name='playerinfo_team',
name='playtime',
field=models.DurationField(default=datetime.timedelta(0)),
),
migrations.AddField(
model_name='playermasteravailability',
name='end_time',
field=models.DateTimeField(default=datetime.datetime(2024, 10, 26, 0, 32, 4, 805564, tzinfo=datetime.timezone.utc)),
preserve_default=False,
),
migrations.AddField(
model_name='playerteamavailability',
name='end_time',
field=models.DateTimeField(default=datetime.datetime(2024, 10, 26, 0, 32, 13, 959511, tzinfo=datetime.timezone.utc)),
preserve_default=False,
),
]

View File

@ -1,3 +1,4 @@
from datetime import timedelta
from typing import override
from django.db import models
from cpkmodel import CPkModel
@ -44,6 +45,7 @@ class PlayerInfo_Team(models.Model):
choices=TeamRole.choices,
default=TeamRole.PLAYER
)
playtime = models.DurationField(default=timedelta(0))
created_at = models.DateTimeField(auto_now_add=True)
@override
@ -88,8 +90,8 @@ class PlayerRole(models.Model):
class PlayerTeamAvailability(models.Model):
player_info_team = models.ForeignKey(PlayerInfo_Team, on_delete=models.CASCADE)
date = models.DateField()
hour = models.SmallIntegerField()
start_time = models.DateTimeField()
end_time = models.DateTimeField()
class Meta:
constraints = [
@ -105,8 +107,8 @@ class PlayerTeamAvailability(models.Model):
class PlayerMasterAvailability(models.Model):
player_info = models.ForeignKey(PlayerInfo, on_delete=models.CASCADE)
date = models.DateField()
hour = models.SmallIntegerField()
start_time = models.DateTimeField()
end_time = models.DateTimeField()
class Meta:
constraints = [