Add missing screenshots item to user todo

This commit is contained in:
rubenwardy 2022-08-09 13:39:43 +01:00
parent c0447cdcd2
commit 9b7f1e6e88
2 changed files with 25 additions and 1 deletions

@ -173,6 +173,9 @@ def view_user(username=None):
Package.state == PackageState.CHANGES_NEEDED)) \ Package.state == PackageState.CHANGES_NEEDED)) \
.order_by(db.asc(Package.created_at)).all() .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 \ packages_with_small_screenshots = user.maintained_packages \
.filter(Package.screenshots.any(and_(PackageScreenshot.width < PackageScreenshot.SOFT_MIN_SIZE[0], .filter(Package.screenshots.any(and_(PackageScreenshot.width < PackageScreenshot.SOFT_MIN_SIZE[0],
PackageScreenshot.height < PackageScreenshot.SOFT_MIN_SIZE[1]))) \ PackageScreenshot.height < PackageScreenshot.SOFT_MIN_SIZE[1]))) \
@ -190,12 +193,13 @@ def view_user(username=None):
.all() .all()
needs_tags = user.maintained_packages \ 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() .order_by(db.asc(Package.title)).all()
return render_template("todo/user.html", current_tab="user", user=user, return render_template("todo/user.html", current_tab="user", user=user,
unapproved_packages=unapproved_packages, outdated_packages=outdated_packages, unapproved_packages=unapproved_packages, outdated_packages=outdated_packages,
needs_tags=needs_tags, topics_to_add=topics_to_add, 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, packages_with_small_screenshots=packages_with_small_screenshots,
screenshot_min_size=PackageScreenshot.HARD_MIN_SIZE, screenshot_rec_size=PackageScreenshot.SOFT_MIN_SIZE) screenshot_min_size=PackageScreenshot.HARD_MIN_SIZE, screenshot_rec_size=PackageScreenshot.SOFT_MIN_SIZE)

@ -64,6 +64,26 @@
{{ render_outdated_packages(outdated_packages, current_user) }} {{ render_outdated_packages(outdated_packages, current_user) }}
<div class="mt-5"></div>
<h2 id="missing-screenshots">{{ _("Missing Screenshots") }}</h2>
<div class="list-group mt-3 mb-5">
{% for package in packages_with_no_screenshots %}
<a class="list-group-item list-group-item-action" href="{{ package.getURL('packages.screenshots') }}">
<img
class="img-fluid"
style="max-height: 22px; max-width: 22px;"
src="{{ package.getThumbnailOrPlaceholder() }}" />
<span class="pl-2">
{{ package.title }}
</span>
</a>
{% else %}
<p class="text-muted">{{ _("Nothing to do :)") }}</p>
{% endfor %}
</div>
<div class="mt-5"></div> <div class="mt-5"></div>
<h2 id="small-screenshots">{{ _("Small Screenshots") }}</h2> <h2 id="small-screenshots">{{ _("Small Screenshots") }}</h2>
{% if packages_with_small_screenshots %} {% if packages_with_small_screenshots %}