Fix unfulfilled dependency checker

This commit is contained in:
rubenwardy 2022-02-13 09:53:12 +00:00
parent d7c765c972
commit 7a650eb1e4
3 changed files with 19 additions and 19 deletions

@ -56,7 +56,7 @@ def del_stuck_releases():
return redirect(url_for("admin.admin_page"))
@action("Check ZIP releases")
@action("Check all releases (postReleaseCheckUpdate)")
def check_releases():
releases = PackageRelease.query.filter(PackageRelease.url.like("/uploads/%")).all()
@ -73,7 +73,7 @@ def check_releases():
return redirect(url_for("todo.view_editor"))
@action("Check the first release of all packages")
@action("Check latest release of all packages (postReleaseCheckUpdate)")
def reimport_packages():
tasks = []
for package in Package.query.filter(Package.state != PackageState.DELETED).all():
@ -102,7 +102,7 @@ def check_all_forum_accounts():
return redirect(url_for("tasks.check", id=task.id, r=url_for("admin.admin_page")))
@action("Import screenshots")
@action("Import screenshots from Git")
def import_screenshots():
packages = Package.query \
.filter(Package.state != PackageState.DELETED) \
@ -283,7 +283,7 @@ def import_licenses():
@action("Delete inactive users")
def delete_inactive_users():
users = User.query.filter(User.is_active == False, User.packages.is_(None), User.forum_topics.is_(None),
users = User.query.filter(User.is_active == False, ~User.packages.any(), ~User.forum_topics.any(),
User.rank == UserRank.NOT_JOINED).all()
for user in users:
db.session.delete(user)

@ -74,7 +74,7 @@ def view_editor():
unfulfilled_meta_packages = MetaPackage.query \
.filter(~ MetaPackage.packages.any(state=PackageState.APPROVED)) \
.filter(MetaPackage.dependencies.any(Package.state == PackageState.APPROVED, optional=False)) \
.filter(MetaPackage.dependencies.any(Dependency.depender.has(state=PackageState.APPROVED), optional=False)) \
.order_by(db.asc(MetaPackage.name)).count()
return render_template("todo/editor.html", current_tab="editor",
@ -143,7 +143,7 @@ def tags_user():
def metapackages():
mpackages = MetaPackage.query \
.filter(~ MetaPackage.packages.any(state=PackageState.APPROVED)) \
.filter(MetaPackage.dependencies.any(optional=False)) \
.filter(MetaPackage.dependencies.any(Dependency.depender.has(state=PackageState.APPROVED), optional=False)) \
.order_by(db.asc(MetaPackage.name)).all()
return render_template("todo/metapackages.html", mpackages=mpackages)

@ -123,22 +123,22 @@
</div>
{% endif %}
{% if total_to_tag != 0 %}
<h2 class="mt-5">{{ _("Tag Packages") }}</h2>
<h2 class="mt-5">{{ _("Tag Packages") }}</h2>
<p>
{{ _("%(total_to_tag)d / %(total_packages)d packages don't have any tags.",
total_to_tag=total_to_tag, total_packages=total_packages) }}
</p>
<p>
{{ _("%(total_to_tag)d / %(total_packages)d packages don't have any tags.",
total_to_tag=total_to_tag, total_packages=total_packages) }}
</p>
<div class="progress my-4">
{% set perc = 100 * (total_packages - total_to_tag) / total_packages %}
<div class="progress-bar bg-success" role="progressbar"
style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<a class="btn btn-primary" href="{{ url_for('todo.tags') }}">{{ _("View Tags") }}</a>
<div class="progress my-4">
{% set perc = 100 * (total_packages - total_to_tag) / total_packages %}
<div class="progress-bar bg-success" role="progressbar"
style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<a class="btn btn-primary" href="{{ url_for('todo.tags') }}">{{ _("View Tags") }}</a>
{% endif %}
{% if unfulfilled_meta_packages %}
<h2 class="mt-5">