-
Notifications
You must be signed in to change notification settings - Fork 523
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
Bug when retrieving non-active(soft deleted) patient identifiers #304
Conversation
The 1.9 does not accept ?includeAll=true |
@@ -248,7 +250,13 @@ public void purge(PatientIdentifier delegate, RequestContext context) throws Res | |||
*/ | |||
@Override | |||
public NeedsPaging<PatientIdentifier> doGetAll(Patient parent, RequestContext context) throws ResponseException { | |||
return new NeedsPaging<PatientIdentifier>(parent.getActiveIdentifiers(), context); | |||
List<PatientIdentifier> newPatientIdentifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think patientIdentifiers looks better than newPatientIdentifier?
public void shouldListAllPatientIdentifiersWithVoidedIdentifiersForAPatient() throws Exception { | ||
String urlString = getURI(); | ||
urlString += "?includeAll=true"; | ||
MockHttpServletRequest req = request(RequestMethod.GET, urlString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
52cfa64
to
7869de8
Compare
Feedback has been implemented. |
assertEquals(false, service.getPatientIdentifierByUuid(getUuid()).isVoided()); | ||
MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); | ||
req.addParameter("!purge", ""); | ||
final String reason = "none"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your changes in PatientIdentifierResource1_8.java were removed, would this test fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because getAllCount would return 1
MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); | ||
req.addParameter("!purge", ""); | ||
final String reason = "none"; | ||
req.addParameter("testing voided", reason); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the name of the above parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "Testing voided" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am referring to line 134
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you look at the documentation of this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
7869de8
to
6e3e174
Compare
public void shouldListAllPatientIdentifiersWithVoidedIdentifiersForAPatient() throws Exception { | ||
assertEquals(false, service.getPatientIdentifierByUuid(getUuid()).isVoided()); | ||
MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); | ||
req.addParameter("!purge", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use of the above parameter on line 132?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Void, I guess it can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean it is the way of making the request void the data?
assertEquals(true, service.getPatientIdentifierByUuid(getUuid()).isVoided()); | ||
SimpleObject result = deserialize(handle(newGetRequest(getURI(), new Parameter( | ||
RestConstants.REQUEST_PROPERTY_FOR_INCLUDE_ALL, "true")))); | ||
assertNotEquals(getAllCount(), Util.getResultsSize(result)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make another call and corresponding assertion where the includeAll parameter has a value of false?
6e3e174
to
f8c389e
Compare
I have implemented that by calling with true then testing
since getAllCount() will return 1 and getAllWithVoided will return 2 which includes the voided for false
since getAllCount() will return one and getAllWithVoided(false) will be 1 excluding the voided |
assertNotEquals(getAllCount(), Util.getResultsSize(result)); | ||
|
||
SimpleObject nextResult = deserialize(handle(newGetRequest(getURI(), new Parameter( | ||
RestConstants.REQUEST_PROPERTY_FOR_INCLUDE_ALL, "false")))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't getAllCount() the one that has all, including the voided ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Get all returns only the active Identifiers
return service.getPatientByUuid(RestTestConstants1_8.PATIENT_UUID).getActiveIdentifiers().size();
That is why getAllCount() returns 1 after we void an identifier instead of two but REQUEST_PROPERTY_FOR_INCLUDE_ALL returns 2 including the voided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i see! 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 😄 Is there any other thing I should do?
JIRA TICKET NAME:
RESTWS-675: Fix inability to retrieve soft deleted patient identifiers
SUMMARY:
This PR fixes Bug when retrieving non-active(soft deleted) patient identifiers