Left outer join on domains tables to avoid missing results

This commit is contained in:
Curtis Castrapel 2018-11-13 14:33:17 -08:00
parent 92a771f5ed
commit 3ce8abe46e
2 changed files with 3 additions and 1 deletions

View File

@ -178,6 +178,8 @@ def render(args):
terms = filt.split(';')
if 'active' in filt:
query = query.filter(Authority.active == truthiness(terms[1]))
elif 'cn' in filt:
query = query.join(Authority.active == truthiness(terms[1]))
else:
query = database.filter(query, Authority, terms)

View File

@ -333,7 +333,7 @@ def render(args):
elif 'id' in terms:
query = query.filter(Certificate.id == cast(terms[1], Integer))
elif 'name' in terms:
query = query.join(certificate_associations).join(Domain).filter(
query = query.outerjoin(certificate_associations).outerjoin(Domain).filter(
or_(
Certificate.name.ilike(term),
Domain.name.ilike(term),