master
Aevann1 2022-05-03 06:28:42 +02:00
parent 394244a4cd
commit 5e2da5673c
3 changed files with 27 additions and 6 deletions

View File

@ -190,6 +190,7 @@ class User(Base):
elif self.patron == 4: discount = 0.75
elif self.patron == 5: discount = 0.70
elif self.patron == 6: discount = 0.65
elif self.patron == 7: discount = 0.60
else: discount = 1
for badge in [69,70,71,72,73]:

View File

@ -710,11 +710,7 @@ def users_list(v):
try: page = int(request.values.get("page", 1))
except: page = 1
users = g.db.query(User).filter_by(is_banned=0
).order_by(User.created_utc.desc()
).offset(25 * (page - 1)).limit(26)
users = [x for x in users]
users = g.db.query(User).order_by(User.id.desc()).offset(25 * (page - 1)).limit(26).all()
next_exists = (len(users) > 25)
users = users[:25]
@ -726,6 +722,30 @@ def users_list(v):
page=page,
)
@app.get("/badge_owners/<bid>")
@auth_required
def bid_list(v, bid):
try: bid = int(bid)
except: abort(400)
try: page = int(request.values.get("page", 1))
except: page = 1
users = g.db.query(User).join(Badge, Badge.user_id == User.id).filter(Badge.badge_id==bid).offset(25 * (page - 1)).limit(26).all()
next_exists = (len(users) > 25)
users = users[:25]
return render_template("admin/new_users.html",
v=v,
users=users,
next_exists=next_exists,
page=page,
)
@app.get("/admin/alt_votes")
@admin_level_required(2)
def alt_votes_get(v):

View File

@ -30,7 +30,7 @@
<td><img alt="{{badge.name}}" loading="lazy" src="/assets/images/badges/{{badge.id}}.webp?v=1016" width=45.83 height=50>
<td>{{badge.description}}</td>
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
<td class="badges-rarity-qty">{{ ct[0] }}</td>
<td class="badges-rarity-qty"><a href="/badge_owners/{{badge.id}}">{{ ct[0] }}</a></td>
<td class="badges-rarity-ratio">{{ "{:0.3f}".format(ct[1]) }}%</td>
</tr>
{% endfor %}