1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00
royalnet/royalpack/halloween2020/trionfistatus.py

137 lines
2.7 KiB
Python
Raw Normal View History

2020-09-20 15:45:57 +00:00
from sqlalchemy import *
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declared_attr
2020-09-25 01:55:19 +00:00
from .trionfilist import trionfilist
2020-09-20 15:45:57 +00:00
2020-09-22 17:42:57 +00:00
class TrionfiStatus:
__tablename__ = "trionfistatus"
2020-09-20 15:45:57 +00:00
@declared_attr
2020-09-22 02:01:22 +00:00
def _steamid(self):
return Column(BigInteger, ForeignKey("steam._steamid"), primary_key=True)
2020-09-20 15:45:57 +00:00
@declared_attr
2020-09-22 02:01:22 +00:00
def steam(self):
2020-09-22 17:42:57 +00:00
return relationship("Steam", backref=backref("trionfistatus", uselist=False))
2020-09-20 15:45:57 +00:00
@declared_attr
def zero(self):
return Column(DateTime)
@declared_attr
def i(self):
return Column(DateTime)
@declared_attr
def ii(self):
return Column(DateTime)
@declared_attr
def iii(self):
return Column(DateTime)
@declared_attr
def iv(self):
return Column(DateTime)
@declared_attr
def v(self):
return Column(DateTime)
@declared_attr
def vi(self):
return Column(DateTime)
@declared_attr
def vii(self):
return Column(DateTime)
@declared_attr
def viii(self):
return Column(DateTime)
@declared_attr
def ix(self):
return Column(DateTime)
@declared_attr
def x(self):
return Column(DateTime)
@declared_attr
def xi(self):
return Column(DateTime)
@declared_attr
def xii(self):
return Column(DateTime)
@declared_attr
def xiii(self):
return Column(DateTime)
@declared_attr
def xiv(self):
return Column(DateTime)
@declared_attr
def xv(self):
return Column(DateTime)
@declared_attr
def xvi(self):
return Column(DateTime)
@declared_attr
def xvii(self):
return Column(DateTime)
@declared_attr
def xviii(self):
return Column(DateTime)
@declared_attr
def xix(self):
return Column(DateTime)
@declared_attr
def xx(self):
return Column(DateTime)
@declared_attr
def xxi(self):
return Column(DateTime)
def total(self):
return sum(map(lambda i: 0 if i is None else 1, [
self.zero,
self.i,
self.ii,
self.iii,
self.iv,
self.v,
self.vi,
self.vii,
self.viii,
self.ix,
self.x,
self.xi,
self.xii,
self.xiii,
self.xiv,
self.xv,
self.xvi,
self.xvii,
self.xviii,
self.xix,
self.xx,
self.xxi,
]))
def json(self):
return {
2020-09-25 01:55:19 +00:00
"completed": self.total(),
"trionfi": {trionfo.variable: trionfo.json_user(self) for trionfo in trionfilist}
2020-09-20 15:45:57 +00:00
}