Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex for donor and donee document list matching #126

Closed
vipulnaik opened this issue Dec 19, 2019 · 1 comment
Closed

Fix regex for donor and donee document list matching #126

vipulnaik opened this issue Dec 19, 2019 · 1 comment
Assignees

Comments

@vipulnaik
Copy link
Owner

@vipulnaik vipulnaik commented Dec 19, 2019

Current SQL query in https://github.com/vipulnaik/donations/blob/master/access-portal/backend/donorDocumentList.inc https://github.com/vipulnaik/donations/blob/master/access-portal/backend/doneeDocumentList.inc and https://github.com/vipulnaik/donations/blob/master/access-portal/backend/donorDoneeDocumentList.inc
says affected_donors REGEXP <donor string> and affected_donees REGEXP <donee string> etc.

The problem is that occasionally, the name of one donee can be a substring of the name of another donee, so this can lead to false matches. An example is how "Ought" is a substring of "Forethought Foundation for Global Priorities Research"; see https://donations.vipulnaik.com/donee.php?donee=Ought

Ideally, we want to use a regex match against <start of string or pipe sign><donor or donee string><end of string or pipe sign> and update all SQL queries accordingly. I think we should be able to get a single regex that works for this; if not, in the worst case, we'll need to make a few cases.

@riceissa

This comment has been minimized.

Copy link
Collaborator

@riceissa riceissa commented Dec 20, 2019

Here are some test cases I played around with: https://gist.github.com/riceissa/09638576b30132c6c7a3df83ec95ca14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.