Uh oh!
There was an error while loading. Please reload this page.
Fix person and organization filter for affiliations - #96
Conversation
emiliom
commented
Sep 26, 2017
So, a |
lsetiawan
commented
Sep 26, 2017
@emiliom How do I go about that? Sorry.. not SQLAlchemy pro here 😉 |
emiliom
commented
Sep 26, 2017
Neither am I! But I'd look for similar examples in other query functions. If it is in fact doable, it seems cleaner to reuse that "predefined" relationship rather than adding explicit joins. |
| q = q.join(People) | ||
| if personfirst: q = q.filter(People.PersonFirstName.ilike(personfirst)) | ||
| if personlast: q = q.filter(People.PersonLastName.ilike(personlast)) | ||
| if orgcode: q = q.join(Affiliations.OrganizationObj).filter( |
There was a problem hiding this comment.
@emiliom Is this what you're looking for? I still have to do the join... Can't find anything that simply filters straight up from relationship.
There was a problem hiding this comment.
emiliom
commented
Sep 26, 2017
Hmm. That doesn't look better 😞 After looking at what's used in If you've tested this, let's go with it. It would seem cleaner and possibly more efficient (in some cases) to do all the joining in the Thanks. |
emiliom
commented
Sep 26, 2017
Let me know if you've tested this commit, and I'll accept the PR. |
lsetiawan
commented
Sep 26, 2017
This has been tested and good to go with your approval. Thanks! |
Overview
This PR addresses #95. It joins the necessary table to
Affiliationstable so that filter can actually occur. I have tested it and it seems to work.