mirror of
https://github.com/solero/houdini.git
synced 2024-11-22 13:37:28 +00:00
Cache derived properties in penguin data class
This commit is contained in:
parent
7862101b1b
commit
8e67710f4c
@ -117,15 +117,18 @@ class Penguin(db.Model):
|
|||||||
return get_minutes()
|
return get_minutes()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@lru_cache()
|
||||||
def age(self):
|
def age(self):
|
||||||
return (datetime.now() - self.registration_date).days
|
return (datetime.now() - self.registration_date).days
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@lru_cache()
|
||||||
def approval(self):
|
def approval(self):
|
||||||
return int(f'{self.approval_ru * 1}{self.approval_de * 1}0{self.approval_es * 1}'
|
return int(f'{self.approval_ru * 1}{self.approval_de * 1}0{self.approval_es * 1}'
|
||||||
f'{self.approval_fr * 1}{self.approval_pt * 1}{self.approval_en * 1}', 2)
|
f'{self.approval_fr * 1}{self.approval_pt * 1}{self.approval_en * 1}', 2)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@lru_cache()
|
||||||
def rejection(self):
|
def rejection(self):
|
||||||
return int(f'{self.rejection_ru * 1}{self.rejection_de * 1}0{self.rejection_es * 1}'
|
return int(f'{self.rejection_ru * 1}{self.rejection_de * 1}0{self.rejection_es * 1}'
|
||||||
f'{self.rejection_fr * 1}{self.rejection_pt * 1}{self.rejection_en * 1}', 2)
|
f'{self.rejection_fr * 1}{self.rejection_pt * 1}{self.rejection_en * 1}', 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user