do not display nb_paid_user for client

This commit is contained in:
Son 2021-10-25 14:36:23 +02:00
parent d701b84110
commit 7e0609c39a
2 changed files with 1 additions and 16 deletions

View File

@ -74,8 +74,7 @@
<h6 class="card-subtitle mb-4 text-muted">
Created {{ client.created_at | dt }} <br>
<span class="font-weight-bold">{{ client.nb_user() }}</span> users.
<span class="font-weight-bold">{{ client.nb_paid_user() }}</span> paid users.
<span class="font-weight-bold">{{ client.nb_user() }}</span> users
<br>
</h6>

View File

@ -991,20 +991,6 @@ class Client(Base, ModelMixin):
def nb_user(self):
return ClientUser.filter_by(client_id=self.id).count()
def nb_paid_user(self) -> int:
res = 0
for client_user in (
Session.query(ClientUser)
.options(joinedload(ClientUser.user))
.filter_by(client_id=self.id)
.all()
):
user = client_user.user
if user.is_paid():
res += 1
return res
def get_scopes(self) -> [Scope]:
# todo: client can choose which scopes they want to have access
return [Scope.NAME, Scope.EMAIL, Scope.AVATAR_URL]