Create death events function.

This commit is contained in:
luxick
2018-03-14 14:47:04 +01:00
parent ac01a4441b
commit 48ed0d830f
7 changed files with 38 additions and 7 deletions

View File

@@ -32,6 +32,16 @@ class WriteFunctions:
sql.Drink.vol: drink.vol})
.execute())
@staticmethod
def save_death(death: 'models.Death'):
with sql.db.atomic():
created_id = (sql.Death
.insert(info=death.info, player=death.player, enemy=death.enemy, episode=death.episode,
time=death.time)
.execute())
for penalty in death.penalties:
sql.Penalty.create(death=created_id, size=penalty.size, drink=penalty.drink, player=penalty.player)
@staticmethod
def update_season(season: 'models.Season', *_):
(sql.Season