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

add missing office where clause in Clob getAll query #937

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

adamkorynta
Copy link
Collaborator

No description provided.

@rma-rripken
Copy link
Collaborator

Since we (probably me) got this wrong at least once there should probably be tests that go along with these changes.
This pr still isn't right. The count sub-query uses JooqDao.caseInsensitiveLikeRegex but the data retrieval part uses 'DSL.upper(v_office.OFFICE_ID).like(officeLike.toUpperCase()))' those should align -right? at least I think they should.
The paging also doesn't look right. I guess it was broken before you got here but it seems to me that this needs to order by officeId and clobId

.join(v_office).on(v_clob.OFFICE_CODE.eq(v_office.OFFICE_CODE))
.where(JooqDao.caseInsensitiveLikeRegex(v_clob.ID,idRegex))
.and(DSL.upper(v_clob.ID).greaterThan(clobCursor))
.and(officeLike == null ? noCondition() : DSL.upper(v_office.OFFICE_ID).like(officeLike.toUpperCase()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be caseInsensitiveRegexLike -right?
Paging should also order by office and clobId.
Probably need test
Is there an approved issue for these changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No issue, I'll create one, good call on the regex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added tests, made office id support regex, ordered the page by office id and clob id.

public Clobs getClobs(String cursor, int pageSize, String officeLike,
boolean includeValues, String idRegex) {
int total = 0;
String clobCursor = "*";
AV_CLOB v_clob = AV_CLOB.AV_CLOB;
AV_OFFICE v_office = AV_OFFICE.AV_OFFICE;

Condition whereClause = JooqDao.caseInsensitiveLikeRegex(v_clob.ID, idRegex)
.and(officeLike == null ? noCondition() : JooqDao.caseInsensitiveLikeRegex(v_office.OFFICE_ID, officeLike));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't you add a caseInsensitiveLikeRegexNullTrue that does exactly this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wow, I have no recollection of writing that, but I guess I did!

.from(v_clob)
.join(v_office).on(v_clob.OFFICE_CODE.eq(v_office.OFFICE_CODE))
.where(whereClause)
.and(DSL.upper(v_clob.ID).greaterThan(clobCursor))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This still isn't quite right. At least in my opinion. If you are ordering by office and clobId then I think the paging has to do the sameOffice/nextOffice thing. See buildPagingCondition in TimeSeriesDaoImpl for what I'm talking about

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fairly certain Ryan is correct. especially if you have more than one office possibly coming through, but even just limiting to a single you want that sorting to be consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup, thanks for catching this. Updated to match how you handled it in the projects endpoint

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there another commit? I don't see it in these changes

Copy link
Collaborator

@rma-rripken rma-rripken left a comment

Choose a reason for hiding this comment

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

I think the paging cursor needs to deal with the office and clobId of the cursor

Copy link
Collaborator

@rma-rripken rma-rripken left a comment

Choose a reason for hiding this comment

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

The paging conditions still don't look right. From your two part cursor you want to find items in the same office that have later clobIds AND you also want things that are in latter offices. Are you doing that and I'm not seeing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

Clob getAll missing office filter in query
3 participants