mirror of
https://github.com/minetest/contentdb.git
synced 2025-03-23 02:32:28 +01:00
Fix crash on user on None min_package_rank
This commit is contained in:
@ -75,7 +75,8 @@ def profile(username):
|
|||||||
all_package_ranks = db.session.query(
|
all_package_ranks = db.session.query(
|
||||||
Package.author_id,
|
Package.author_id,
|
||||||
func.rank().over(order_by=db.desc(Package.score)) \
|
func.rank().over(order_by=db.desc(Package.score)) \
|
||||||
.label('rank')).order_by(db.asc(text("rank"))).subquery()
|
.label('rank')).order_by(db.asc(text("rank"))) \
|
||||||
|
.filter_by(state=PackageState.APPROVED).subquery()
|
||||||
user_package_ranks = db.session.query(all_package_ranks) \
|
user_package_ranks = db.session.query(all_package_ranks) \
|
||||||
.filter_by(author_id=user.id).first()
|
.filter_by(author_id=user.id).first()
|
||||||
min_package_rank = user_package_ranks[1] if user_package_ranks else None
|
min_package_rank = user_package_ranks[1] if user_package_ranks else None
|
||||||
|
@ -218,7 +218,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if min_package_rank <= 30 %}
|
{% if min_package_rank is not none and min_package_rank <= 30 %}
|
||||||
{% if min_package_rank <= 5 %}
|
{% if min_package_rank <= 5 %}
|
||||||
{% set badge_color = "gold" %}
|
{% set badge_color = "gold" %}
|
||||||
{% elif min_package_rank <= 10 %}
|
{% elif min_package_rank <= 10 %}
|
||||||
|
Reference in New Issue
Block a user