optimize provider and publisher pages

main
eric 2023-09-07 14:47:34 -04:00
parent 1af4b62fd0
commit faf217aa44
4 changed files with 17 additions and 12 deletions

View File

@ -375,6 +375,7 @@ table th {
.content.is-large {
font-size: 1.5rem
}
.section {
padding: 1.5rem;
}
@ -384,4 +385,9 @@ header nav a {
font-size: medium;
font-weight: bold;
}
.itemtitle {
font-weight: 600;
padding-top: 1.5ex;
}
</style>

View File

@ -23,7 +23,9 @@ Link Checking for
<tr {% if code.recent_check__return_code != 200 %} style="color:red"{% endif %}>
<td> {{ code.recent_check__return_code }} </td>
<td> <a href="#code{{ code.recent_check__return_code }}">{{ code.recent_check__return_code__count }}</a>
<td><a href="{% url 'fixing' %}#{{ code.recent_check__return_code }}">how to fix</a></td>
<td>{% if code.recent_check__return_code != 200 %}
<a href="{% url 'fixing' %}#code{{ code.recent_check__return_code }}">how to fix</a>
{% endif %}</td>
</tr>
{% empty %}
<tr><td colspan=2>None of the active links for {{ provider.provider }} have been checked.</td>

View File

@ -5,10 +5,6 @@
{% include "basestyle.html" %}
<style>
.itemtitle {
padding-top: 1.5ex;
font-weight: bold;
}
.checked td {
padding-right: 2em
}
@ -35,12 +31,14 @@ DOAB Linkchecking for
<th></th>
</tr>
{% for codeobj in codes %}
{% with code=codeobj.recent_check__return_code %}
{% with code=codeobj.recent_check__return_code codecount=codeobj.recent_check__return_code__count %}
<tr {% if code != 200 %} style="color:red"{% endif %}>
<td> {{ code }} </td>
<td> <a href="#code{{ code }}">{% if codeobj.count < 998 %}{{ codeobj.count }}
<td> <a href="#code{{ code }}">{% if codecount < 998 %}{{ codecount }}
{% else %} more than 1000 {% endif %}</a> </td>
<td> <a href='{{ code }}'>?</a> </td>
<td>{% if code != 200 %}
<a href="{% url 'fixing' %}#code{{ code }}">how to fix</a>
{% endif %}</td>
</tr>
{% endwith %}
{% empty %}
@ -54,7 +52,7 @@ DOAB Linkchecking for
{% with code=codeobj.recent_check__return_code %}
<h3{% if code != 200 %} style="color:red"{% endif %} id="code{{ code }}"> {{ code }}</h3>
{% for link in codeobj.links %}
{% with title=link.items.all.0.title %}
{% with title=link.title %}
{% ifchanged title %}<div class='itemtitle'>{{ title }}</div>{% endifchanged %}
<div class='itemlink'><a href="{{ link.url }}">{{ link.url }}</a></div>

View File

@ -115,16 +115,15 @@ class PublisherView(generic.TemplateView):
pub = ''
publisher_links = Link.objects.filter(
items__publisher_name=pub, items__status=1, recent_check__isnull=False
)
).annotate(title=F('items__title'))
link_count = publisher_links.distinct().count()
codes = publisher_links.order_by('-recent_check__return_code').values(
'recent_check__return_code').distinct()
'recent_check__return_code').distinct().annotate(Count('recent_check__return_code'))
for code in codes:
code['links'] = publisher_links.filter(live=True,
recent_check__return_code=code['recent_check__return_code'],
).order_by('items__title')
code['count'] = code['links'].count()
return {'codes': codes, 'publisher': pub, 'count': link_count}