aurweb/templates/dashboard.html
Kevin Morris 4de18d8134
fix(FastAPI): voted/notified query efficiency
Previously, we were running a single ORM query for every single package
to check for its voted or notified states. Now, we perform a single
ORM query for each of the set of voted or notified packages in
relation with the request user.

This improves performance drastically at the expense of some
manual code additions and set-dependency; i.e. we add a bit
more complexity and roundabout way of getting our data.

Closes: https://gitlab.archlinux.org/archlinux/aurweb/-/issues/102

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-09-19 00:34:08 -07:00

65 lines
2 KiB
HTML

<div id="intro" class="box">
<h2>{{ "Dashboard" | tr }}</h2>
<h3>{{ "My Flagged Packages" | tr }}</h3>
{% if not flagged_packages %}
<p>{{ "No packages matched your search criteria." | tr }}</p>
{% else %}
{% with table_id = "flagged-packages",
packages = flagged_packages,
votes = flagged_packages_voted,
notified = flagged_packages_notified
%}
{% include 'partials/packages/results.html' %}
{% endwith %}
{% endif %}
<h3>{{ "My Requests" | tr }}</h3>
{% if not package_requests %}
<p>{{ "No requests matched your search criteria." | tr }}</p>
{% else %}
{% with requests = package_requests %}
{% include 'partials/packages/requests.html' %}
{% endwith %}
{% endif %}
</div>
<div id="intro" class="box">
<h2>{{ "My Packages" | tr }}</h2>
<p>
<a href="/packages/?SeB=m&K={{ request.user.Username }}">
{{ "Search for packages I maintain" | tr }}
</a>
</p>
{% if not packages %}
<p>{{ "No packages matched your search criteria." | tr }}</p>
{% else %}
{% with table_id = "my-packages",
votes = packages_voted,
notified = packages_notified
%}
{% include 'partials/packages/results.html' %}
{% endwith %}
{% endif %}
</div>
<div id="intro" class="box">
<h2>{{ "Co-Maintained Packages" | tr }}</h2>
<p>
<a href="/packages/?SeB=c&K={{ request.user.Username }}">
{{ "Search for packages I co-maintain" | tr }}
</a>
</p>
{% if not comaintained %}
<p>{{ "No packages matched your search criteria." | tr }}</p>
{% else %}
{% with table_id = "comaintained-packages",
packages = comaintained,
votes = comaintained_voted,
notified = comaintained_notified
%}
{% include 'partials/packages/results.html' %}
{% endwith %}
{% endif %}
</div>