From 9b7f1e6e887c2da3ad63ae88c005af8a30015318 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 9 Aug 2022 13:39:43 +0100 Subject: [PATCH] Add missing screenshots item to user todo --- app/blueprints/todo/__init__.py | 6 +++++- app/templates/todo/user.html | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/blueprints/todo/__init__.py b/app/blueprints/todo/__init__.py index df328681..0d64ad34 100644 --- a/app/blueprints/todo/__init__.py +++ b/app/blueprints/todo/__init__.py @@ -173,6 +173,9 @@ def view_user(username=None): Package.state == PackageState.CHANGES_NEEDED)) \ .order_by(db.asc(Package.created_at)).all() + packages_with_no_screenshots = user.maintained_packages.filter( + ~Package.screenshots.any(), Package.state == PackageState.APPROVED).all() + packages_with_small_screenshots = user.maintained_packages \ .filter(Package.screenshots.any(and_(PackageScreenshot.width < PackageScreenshot.SOFT_MIN_SIZE[0], PackageScreenshot.height < PackageScreenshot.SOFT_MIN_SIZE[1]))) \ @@ -190,12 +193,13 @@ def view_user(username=None): .all() needs_tags = user.maintained_packages \ - .filter(Package.state != PackageState.DELETED, Package.tags==None) \ + .filter(Package.state != PackageState.DELETED, ~Package.tags.any()) \ .order_by(db.asc(Package.title)).all() return render_template("todo/user.html", current_tab="user", user=user, unapproved_packages=unapproved_packages, outdated_packages=outdated_packages, needs_tags=needs_tags, topics_to_add=topics_to_add, + packages_with_no_screenshots=packages_with_no_screenshots, packages_with_small_screenshots=packages_with_small_screenshots, screenshot_min_size=PackageScreenshot.HARD_MIN_SIZE, screenshot_rec_size=PackageScreenshot.SOFT_MIN_SIZE) diff --git a/app/templates/todo/user.html b/app/templates/todo/user.html index e0a32947..a707d3b3 100644 --- a/app/templates/todo/user.html +++ b/app/templates/todo/user.html @@ -64,6 +64,26 @@ {{ render_outdated_packages(outdated_packages, current_user) }} +
+

{{ _("Missing Screenshots") }}

+
+ {% for package in packages_with_no_screenshots %} + + + + + {{ package.title }} + + + {% else %} +

{{ _("Nothing to do :)") }}

+ {% endfor %} +
+ +

{{ _("Small Screenshots") }}

{% if packages_with_small_screenshots %}