diff --git a/app/blueprints/users/profile.py b/app/blueprints/users/profile.py index a444e2b0..1f48f8be 100644 --- a/app/blueprints/users/profile.py +++ b/app/blueprints/users/profile.py @@ -75,7 +75,8 @@ def profile(username): all_package_ranks = db.session.query( Package.author_id, 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) \ .filter_by(author_id=user.id).first() min_package_rank = user_package_ranks[1] if user_package_ranks else None diff --git a/app/templates/users/profile.html b/app/templates/users/profile.html index 6e32745e..984799e1 100644 --- a/app/templates/users/profile.html +++ b/app/templates/users/profile.html @@ -218,7 +218,7 @@ {% endif %} - {% if min_package_rank <= 30 %} + {% if min_package_rank is not none and min_package_rank <= 30 %} {% if min_package_rank <= 5 %} {% set badge_color = "gold" %} {% elif min_package_rank <= 10 %}