rename function

master
Aevann 2023-05-11 17:03:51 +03:00
parent 17c56fa776
commit c8d6872761
2 changed files with 7 additions and 2 deletions

View File

@ -177,7 +177,7 @@ class User(Base):
sub_mods = relationship("Mod", primaryjoin="User.id == Mod.user_id", lazy="raise") sub_mods = relationship("Mod", primaryjoin="User.id == Mod.user_id", lazy="raise")
sub_exiles = relationship("Exile", primaryjoin="User.id == Exile.user_id", lazy="raise") sub_exiles = relationship("Exile", primaryjoin="User.id == Exile.user_id", lazy="raise")
lifetime_donated = deferred(Column(Integer, server_default=FetchedValue())) lifetimedonated = deferred(Column(Integer, server_default=FetchedValue()))
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -251,6 +251,11 @@ class User(Base):
return (succeeded, charged_coins) return (succeeded, charged_coins)
@property
@lazy
def lifetime_donated(self):
return self.lifetimedonated or 0
@property @property
@lazy @lazy
def num_of_bought_awards(self): def num_of_bought_awards(self):

View File

@ -1,4 +1,4 @@
create function public.lifetime_donated(public.users) returns integer create function public.lifetimedonated(public.users) returns integer
language sql immutable strict language sql immutable strict
as $_$ as $_$
select sum(amount) select sum(amount)