Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

fix(patients): fixes search when using special characters #2012

Merged
merged 41 commits into from
Apr 30, 2020

Conversation

JDarke
Copy link
Contributor

@JDarke JDarke commented Apr 24, 2020

Fixes #1999.

Search string in patient search field is now cleaned of any breaking special characters.

Removes any number of occurrences of these chars:
[*?()

JDarke and others added 18 commits April 21, 2020 10:38
Reason field on new appointment screen no longer a required field.  Line 21, Label element now takes
isRequired attr from interface Props.

fix HospitalRun#1997
Previously added a listing for yarn in the dependencies in package.json.  This commit undoes that.

re |
Added a test case to test if the Label receives the isRequired prop on required fields

re HospitalRun#2003
Changed const expectedValue to const expectedRequired, named for prop isRequired

re HospitalRun#2003
Added a step to take the search string and remove all non-letter/whitespace characters. Line 16 and
22

fix HospitalRun#1999
Added a step to remove all non-alphabetical and whitespace characters from search string regex

fix HospitalRun#1999
Removed special chars that interfered with RegExp in search strings

re HospitalRun#1999
@vercel
Copy link

vercel bot commented Apr 24, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/6fxtwuuth
✅ Preview: https://hospitalrun-frontend-git-fork-jdarke-master.hospitalrun.now.sh

@@ -13,12 +13,13 @@ export class PatientRepository extends Repository<Patient> {
}

async search(text: string): Promise<Patient[]> {
const cleanText = text.replace(/[\\[()?*]+/g, '')
Copy link
Contributor

@akshay-ap akshay-ap Apr 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also checked with String {1}.
SyntaxError: Invalid regular expression: /{1}/: Nothing to repeat.
Can you please handle this case as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should also remove ], and {, and }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we need to remove all valid regex chars. Is there any lib out there that can help us to not forget any char?

@matteovivona matteovivona added the in progress indicates that issue/pull request is currently being worked on label Apr 24, 2020
@matteovivona matteovivona added this to the v2.0 milestone Apr 24, 2020
@gitpod-io
Copy link

gitpod-io bot commented Apr 24, 2020

@vercel vercel bot temporarily deployed to Preview April 24, 2020 16:55 Inactive
@jackcmeyer jackcmeyer requested a review from fox1t April 27, 2020 21:49
@jackcmeyer jackcmeyer assigned jackcmeyer and fox1t and unassigned jackcmeyer Apr 27, 2020
@vercel vercel bot requested a deployment to Preview April 28, 2020 07:56 Abandoned
@jackcmeyer jackcmeyer merged commit 1693e5f into HospitalRun:master Apr 30, 2020
@jackcmeyer jackcmeyer added patients issue/pull request that interacts with patients module 🚀enhancement an issue/pull request that adds a feature to the application labels Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀enhancement an issue/pull request that adds a feature to the application in progress indicates that issue/pull request is currently being worked on patients issue/pull request that interacts with patients module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while searching Patient
5 participants