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

LIMS-1025: Fix lab contact search #681

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

ndg63276
Copy link
Collaborator

@ndg63276 ndg63276 commented Oct 9, 2023

JIRA ticket: LIMS-1025

Summary:

Fix lab contact search

Changes:

  • Create a where clause to match the passed in search term to any of the lab contact fields
  • Start with a known false condition as each field adds an "or" clause

To test:

  • Go to a list of lab contacts on a proposal and search for each field in turn
  • View a single lab contact, test it displays correctly


$tot = $this->db->pq("SELECT count(c.labcontactid) as tot FROM labcontact c $where", $args);
if ($this->has_arg('s')) {
$st = sizeof($args) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

This pattern is repeated everywhere, lets not do it again. Instead we should pass s and a list of field names to a whereSearch method of WhereClauseQueryBuilder which is probably part of, or at least used by, DatabaseQueryBuilder. The query builder can be used directly here or even extended to do the whole paginate search.
Would love to see the pageing code but in there too.
This function should be something like:

query.where(proposalId, $this->proposalid)
if cid:
  query.where(proposalId, $this->proposalid)
query.search($fields, this->arg('s')

$where = query.where_clause()

Copy link
Contributor

@John-Holt-Tessella John-Holt-Tessella left a comment

Choose a reason for hiding this comment

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

But then it is my change :-)

@ndg63276
Copy link
Collaborator Author

ndg63276 commented Nov 6, 2023

Looks good to me.

@ndg63276 ndg63276 merged commit 3f41aa0 into prerelease Nov 6, 2023
@ndg63276 ndg63276 deleted the fix/LIMS-1025/fix-lab-contact-search branch November 6, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants