-
Notifications
You must be signed in to change notification settings - Fork 143
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
EA-141: Fixed randomly failing test #162
base: master
Are you sure you want to change the base?
Conversation
The original author intentionally put that assertion. So just removing it is not the fix. |
Got it. I'll start working on an actual fix. |
b05fd91
to
a6d8039
Compare
@dkayiwa I added 2 new methods to AdtService, namely getActiveVisits() and hasActiveVisitsDuring().
now becomes:
I also changed the line:
to:
, going back by a minute. I did this because I wasn't sure whether visits ending at 'now' would be considered active. I think going back by a second would work too, but during creation visits timings are precise up to a minute, so I went with that option. I tested the updated code by running |
Do you have to add the new methods to fix the randomly failing test? |
@dkayiwa I would assume so. I believe the test is trying to check that the number of active visits until the current point in time is 0. Since hasVisitsDuring() returns all visits, I think the new methods would serve the purpose better. |
* during the specified datetime range | ||
* | ||
* @param patient | ||
* @param location |
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 document these params?
@@ -300,6 +300,29 @@ VisitDomainWrapper createRetrospectiveVisit(Patient patient, Location location, | |||
*/ | |||
boolean hasVisitDuring(Patient patient, Location location, Date startDatetime, Date stopDatetime); | |||
|
|||
/** | |||
* Gets all visits for the patient at the visit location associated with the specified location |
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.
The description does not seem to communicate what is reflected by the method name.
@dkayiwa I've updated the comments. Please have another look. |
* the specified location during the specified datetime range | ||
* | ||
* @param patient | ||
* @param location |
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 document these params?
@HelioStrike are you still working on this? |
@dkayiwa I think its ready and good to go. By documenting, do you mean sticking a little comment to the right of the @param lines. If so, I'm not sure if I should document the params, because none of the other functions in the file have documented params and it would look a little odd in the file.
And here's the new function, hasActiveVisitDuring():
All I did was change the description a little to match what the new function was doing. Should I go ahead and put a comment beside each param? |
2636a11
to
2b434a3
Compare
Yes go ahead. |
The test AdtServiceComponentTest.test_getVisitsAndHasVisitDuring() failed randomly because of the line:
where stopDate is some date from 2012. There was no test above this line which created a visit between the 2 dates, hence the test wasn't definitely failing. As the test patient was being fetched from the database, there's no telling if the patient doesn't have a visit between the specified date range(hasVisitDuring() internally fetches inactive visits too!), which caused the test to fail 'randomly'. I wasn't sure what I should be replacing the line with, so I simply removed it. Doing that fixes the issue.