roadmap
roadmap copied to clipboard
Strip Outer Spaces Of User Search String and Queried DB Fields
Changes proposed in this PR:
- Addresses the following edge-case: https://github.com/DMPRoadmap/roadmap/pull/3407#issuecomment-2192201540
- In addition to applying
.squishto the user-inputted search term,.stripis applied as well. For example, if" x "was typed by the user, then a query would be made for"x". - Similarly,
trim()is applied to the db values for forUser.firstnameandUser.surname. For example, if the value for one of these fields was" x ", then it would be trimmed to"x".
Additional Notes:
-
There is still another edge-case. That is, it is possible for a
User.firstnameorUser.lastnamevalue to exist in the db having multiple spaces in-between non-space characters. In fact, there are two currently in the production db of DMP Assistant: -
SELECT firstname, lastname FROM users WHERE trim(firstname) LIKE '% %' -- Multiple consecutive spaces within string after applying trim OR trim(surname) LIKE '% %'; ------------------------------- count: 2 -
It would be great to expand the concept of #3407 to other search bars within the app, but the following issue should probably be addressed first: https://github.com/DMPRoadmap/roadmap/issues/3432