Added the "count" pseudo property to the Account data model.

This commit is contained in:
依瑪貓 2023-04-08 09:30:49 +08:00
parent ac3b5523b1
commit e5cc2b5a2f

View File

@ -214,6 +214,25 @@ class Account(db.Model):
"""
return not self.is_real
@property
def count(self) -> int:
"""Returns the number of items in the account.
:return: The number of items in the account.
"""
if not hasattr(self, "__count"):
setattr(self, "__count", 0)
return getattr(self, "__count")
@count.setter
def count(self, count: int) -> None:
"""Sets the number of items in the account.
:param count: The number of items in the account.
:return: None.
"""
setattr(self, "__count", count)
@property
def query_values(self) -> list[str]:
"""Returns the values to be queried.