Merge pull request #2101 from castrapel/left_outer_join

Left outer join on domains tables to avoid missing results
This commit is contained in:
Curtis 2018-11-13 15:08:59 -08:00 committed by GitHub
commit 661bc9cc13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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),