fix problem when links are deprecated

main
eric 2023-05-23 14:16:55 -04:00
parent 151f659da6
commit e70d580aea
1 changed files with 4 additions and 2 deletions

View File

@ -90,8 +90,10 @@ class ProblemPublishersView(generic.TemplateView):
recent_check__isnull=True).exclude( recent_check__isnull=True).exclude(
recent_check__return_code__exact=200) recent_check__return_code__exact=200)
for link in problinks: for link in problinks:
pub = link.items.filter(status=1).first().publisher_name first_item = link.items.filter(status=1).first()
probpubs[pub] = probpubs.get(pub, 0) + 1 if first_item:
pub = first_item.publisher_name
probpubs[pub] = probpubs.get(pub, 0) + 1
pubs = sorted(probpubs.items(), key=lambda x: x[0]) pubs = sorted(probpubs.items(), key=lambda x: x[0])
def fixempty(publist): def fixempty(publist):
for k, v in publist: for k, v in publist: