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

Impossible to make a selection on owner_id in Case Content Provider #2739

Open
BurningAXE opened this issue Feb 4, 2024 · 2 comments
Open

Comments

@BurningAXE
Copy link

BurningAXE commented Feb 4, 2024

Hello!

This is Milen from Simprints. I'm currently working on an integration with CommCare's Case Content Provider and I believe I have found a bug in it's implementation. Following this documentation I'm trying to access the case metadata listing and make a selection based on the owner_id. This is my code:

selection = "owner_id = ?"
selectionArgs = arrayOf(decryptedAttendantId.value)
val caseMetadataCursor = context.contentResolver.query(CASE_METADATA_URI, null, selection, selectionArgs, null)

However, I'm getting a null cursor and looking at the logs from CommCare I see the following exception:

java.lang.RuntimeException: Invalid selection key for case metadata: owner_id

Digging in your code I found out that the OWNER_ID column is actually defined as "owner_ID". I tried passing "owner_ID" in my selection but got the exact same exception. Digging further in your code I found this line which converts all selection keys to lowercase. This essentially makes it impossible to make a selection on the "owner_ID" column.

Let me know if I'm missing something or if you need any more info!

@avazirna
Copy link
Contributor

avazirna commented Feb 9, 2024

Hi Milen,

Thank you for bringing this to our attention. It does seem to be a bug, I don't think we've had people querying this provider using the owner_ID before hence why this hasn't been caught. I will try to push a fix in the next few days, but unsure when we will be able to release this fix. I'm happy to release on a close testing track or provide an apk. Let me know what works best.

Ahmad

@BurningAXE
Copy link
Author

Hi Ahmad,

Thank you! Both work for me but since I am using the Google Play version, it might be easier to just add me to your testing track. My email is my first name @ simprints . com

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

No branches or pull requests

2 participants