make the block number accurate for holes with stealth mode
parent
5b274c95c9
commit
fc19b1a23e
|
@ -26,6 +26,7 @@ class Sub(Base):
|
|||
|
||||
blocks = relationship("SubBlock", primaryjoin="SubBlock.sub==Sub.name")
|
||||
followers = relationship("SubSubscription", primaryjoin="SubSubscription.sub==Sub.name")
|
||||
joins = relationship("SubJoin", lazy="dynamic", primaryjoin="SubJoin.sub==Sub.name")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
|
@ -54,8 +55,8 @@ class Sub(Base):
|
|||
|
||||
@property
|
||||
@lazy
|
||||
def subscription_num(self):
|
||||
return self.subscriptions.count()
|
||||
def join_num(self):
|
||||
return self.joins.count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -553,7 +553,8 @@ def sub_marsey(v, sub):
|
|||
@auth_required
|
||||
def subs(v):
|
||||
subs = g.db.query(Sub, func.count(Submission.sub)).outerjoin(Submission, Sub.name == Submission.sub).group_by(Sub.name).order_by(func.count(Submission.sub).desc()).all()
|
||||
return render_template('sub/subs.html', v=v, subs=subs)
|
||||
total_users = g.db.query(User).count()
|
||||
return render_template('sub/subs.html', v=v, subs=subs, total_users=total_users)
|
||||
|
||||
@app.post("/hole_pin/<pid>")
|
||||
@is_not_permabanned
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
<td><a href="/h/{{sub}}">{{sub}} {% if sub.name in v.all_blocks %}<span class="text-danger">[blocked, visit it to unblock it]</span>{% endif %}</a></td>
|
||||
<td><a href="/h/{{sub}}" >{{count}}</a></td>
|
||||
<td><a href="/h/{{sub}}/followers">{{sub.follow_num}}</a></td>
|
||||
<td><a href="/h/{{sub}}/blockers">{{sub.block_num}}</a></td>
|
||||
{% if sub.stealth %}
|
||||
<td>{{total_users - sub.join_num}}</td>
|
||||
{% else %}
|
||||
<td><a href="/h/{{sub}}/blockers">{{sub.block_num}}</a></td>
|
||||
{% endif %}
|
||||
<td data-time="{{sub.created_utc}}"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue