Default to sort=score on All Outdated Packages

This commit is contained in:
rubenwardy 2021-01-30 15:45:48 +00:00
parent a67e3af172
commit 324815d58d
2 changed files with 5 additions and 4 deletions

View File

@ -180,10 +180,11 @@ def outdated():
.filter(Package.state == PackageState.APPROVED)
sort_by = request.args.get("sort")
if sort_by == "score":
query = query.order_by(db.desc(Package.score))
else:
if sort_by == "date":
query = query.order_by(db.desc(PackageUpdateConfig.outdated_at))
else:
sort_by = "score"
query = query.order_by(db.desc(Package.score))
return render_template("todo/outdated.html", current_tab="outdated",
outdated_packages=query.all(), sort_by=sort_by)

View File

@ -6,7 +6,7 @@
{% block content %}
<div class="btn-group btn-group-sm float-right">
<a class="btn btn-secondary {% if sort_by != 'score' %}active{% endif %}"
<a class="btn btn-secondary {% if sort_by == 'date' %}active{% endif %}"
href="{{ url_set_query(sort='date') }}">
Sort by date
</a>