mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
adding users back in with better query
This commit is contained in:
parent
2249140bf3
commit
6e3de6e9e2
2 changed files with 4 additions and 2 deletions
|
@ -93,8 +93,8 @@ class Instance(db.Model):
|
||||||
def known_communities_count(self):
|
def known_communities_count(self):
|
||||||
return db.session.execute(text(f'SELECT count(*) FROM community WHERE instance_id = {self.id}')).all()[0].count
|
return db.session.execute(text(f'SELECT count(*) FROM community WHERE instance_id = {self.id}')).all()[0].count
|
||||||
|
|
||||||
# def known_users_count(self):
|
def known_users_count(self):
|
||||||
# return db.session.execute(text(f'SELECT count(DISTINCT instance_id) as count FROM USER')).all()[0].count
|
return db.session.execute(text(f'SELECT count(*) FROM "user" WHERE instance_id = {self.id}')).all()[0].count
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Instance {}>'.format(self.domain)
|
return '<Instance {}>'.format(self.domain)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<th>Software</th>
|
<th>Software</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
<th title="{{ _('Known Communities') }}">Communities</td>
|
<th title="{{ _('Known Communities') }}">Communities</td>
|
||||||
|
<th title="{{ _('Known Users') }}">Users</td>
|
||||||
<th>Posts</th>
|
<th>Posts</th>
|
||||||
<th>Post Replies</th>
|
<th>Post Replies</th>
|
||||||
<th>Vote Weight</th>
|
<th>Vote Weight</th>
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
<td>{{ instance.software }}</td>
|
<td>{{ instance.software }}</td>
|
||||||
<td>{{ instance.version if instance.version }}</td>
|
<td>{{ instance.version if instance.version }}</td>
|
||||||
<td>{{ instance.known_communities_count() }}</td>
|
<td>{{ instance.known_communities_count() }}</td>
|
||||||
|
<td>{{ instance.known_users_count() }}</td>
|
||||||
<td>{{ instance.post_count() }}</td>
|
<td>{{ instance.post_count() }}</td>
|
||||||
<td>{{ instance.post_replies_count() }}</td>
|
<td>{{ instance.post_replies_count() }}</td>
|
||||||
<td>{{ instance.vote_weight }}</td>
|
<td>{{ instance.vote_weight }}</td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue