Skip to content

Commit

Permalink
examiner: Fix missing exam urls in organize
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed Jan 21, 2019
1 parent d6ee614 commit e19435a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions examiner/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,21 @@ def organize(self):
docinfo.language or 'Ukjent',
[],
)
try:
url = DocumentInfoSource.objects.filter(
document_info=docinfo,
verified_by__isnull=False,
).first().pdf.hosted_at.filter(dead_link=False).first()
except (AttributeError, DocumentInfoSource.DoesNotExist):
url = DocumentInfoSource.objects.filter(
document_info=docinfo,
).first().pdf.hosted_at.filter(dead_link=False).first()

if url not in urls:
urls.append(url)
for pdf in docinfo.pdfs.all():
url = pdf.hosted_at.filter(dead_link=False).first()
if url not in urls:
urls.append(url)

# TODO: Make this type of logic work
# try:
# url = DocumentInfoSource.objects.filter(
# document_info=docinfo,
# verified_by__isnull=False,
# ).first().pdf.hosted_at.filter(dead_link=False).first()
# except (AttributeError, DocumentInfoSource.DoesNotExist):
# url = DocumentInfoSource.objects.filter(
# document_info=docinfo,
# ).first().pdf.hosted_at.filter(dead_link=False).first()

return organization

Expand Down

0 comments on commit e19435a

Please sign in to comment.