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-1002: Fix error when creating new laboratory #815

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ndg63276
Copy link
Collaborator

JIRA ticket: LIMS-1002

Summary:

When updating a user to have a laboratory when previously they didn't have one, although the laboratory is created, an error is logged.

Changes:

  • Make the updateLaboratory function return the laboratoryId instead of nothing
  • Use that laboratoryId to get the rest of the info to output to the user
  • Remove unused code getting the laboratory earlier

To test:

  • Find a personId that has no laboratoryId, eg personId 13000, login gnj59924
  • Login to a synchweb dev instance as this person, and get the authentication headers
  • Open a python terminal and do:
>>> import requests
>>> headers = {"Authorization": "Bearer eyJ..."} # using headers from Synchweb
>>> r = requests.patch("http://server:port/api/users/13000", headers=headers, json={"LABNAME": "test"})
>>> r.json()
{'NAME': 'test', 'ADDRESS': None, 'CITY': None, 'POSTCODE': None, 'COUNTRY': None}
  • This only errors the first time, as the laboratoryId is created and set ok, but the server logs an error and no json is returned at the moment. If you want to re-test, you need to clear the laboratoryId, eg
UPDATE Person SET laboratoryId = NULL WHERE personId=13000;
  • NB I don't know how to trigger this code from Synchweb, only via the python, but it obviously did happen, as logged in the ticket.

@gfrn gfrn self-assigned this Aug 19, 2024
@gfrn gfrn self-requested a review August 19, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants