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

Query data endpoint by submission review. Filter NULL review status #2144

Merged
merged 3 commits into from
Sep 17, 2021

Conversation

WinnyTroy
Copy link
Contributor

@WinnyTroy WinnyTroy commented Sep 9, 2021

Changes / Features implemented

  • Test ability to query data whose submission review status is NULL

Steps taken to verify this change does what is intended

  • Included tests
  • Updated documentation
  • QA

Side effects of having these changes

  • Submission review status PENDING can be thought of in 2 ways:
    • Status 3 - For instances when the user had already provided a status, i.e approved/rejected and would like to return submission review status to pending.
    • Status NULL - By default, if no review has been provided for the submission.

Before submitting this PR for review, please make sure you have:

  • Included tests

Closes #2112

@WinnyTroy WinnyTroy force-pushed the null_review_status branch 2 times, most recently from 7486de9 to a55a701 Compare September 15, 2021 08:52
@WinnyTroy WinnyTroy changed the title Query data endpoint by submission review filter review status by Pending Query data endpoint by submission review. Filter NULL review status Sep 15, 2021
Comment on lines 124 to 127
if '$or' not in list(query):
for k, v in query.items():
if v is None:
or_where.extend([u"json->>'{}' IS NULL".format(k)])
Copy link
Contributor

@DavisRayM DavisRayM Sep 15, 2021

Choose a reason for hiding this comment

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

Seems like this functionality would not properly handle queries without the $or query in it; Just seems to check if the value is None and adds the query... should it handle querying the values passed in the query? or is that handled elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems the query is handled in the _parse_where function could we extend that function to handle field_value when it's None instead of looping through the query here perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.
Made that change

@WinnyTroy WinnyTroy force-pushed the null_review_status branch 4 times, most recently from 28e807c to bb3d52d Compare September 16, 2021 06:32
DavisRayM
DavisRayM previously approved these changes Sep 16, 2021
denniswambua
denniswambua previously approved these changes Sep 17, 2021
@denniswambua denniswambua merged commit 74632fc into master Sep 17, 2021
@denniswambua denniswambua deleted the null_review_status branch September 17, 2021 09:19
@DavisRayM DavisRayM mentioned this pull request Oct 7, 2021
1 task
LeonRomo pushed a commit that referenced this pull request Nov 5, 2021
…#2144)

* Add failing tests

* Include ability to generate sql statement for NULL query strings.

* Update data endpoint documentation
denniswambua pushed a commit that referenced this pull request Nov 11, 2021
* test on charts by grouping multiple fields

* test on charts with content type

* update the format to json when content type has been provided

* styling fix

* styling fix

* Update onadata/apps/api/tests/viewsets/test_charts_viewset.py

Co-authored-by: Davis Raymond <[email protected]>

* Clean out Merged Datasets upon xform deletion. Clean out Form Media Files upon form deletion. Add documentation on clean up of filtered datasets (#2136)

* Query data endpoint by submission review. Filter `NULL` review status (#2144)

* Add failing tests

* Include ability to generate sql statement for NULL query strings.

* Update data endpoint documentation

* Remove unnecessary test

* test on charts by grouping multiple fields

* test on charts with content type

* update the format to json when content type has been provided

* styling fix

* styling fix

* Update onadata/apps/api/tests/viewsets/test_charts_viewset.py

Co-authored-by: Davis Raymond <[email protected]>

* Remove unnecessary test

Co-authored-by: Davis Raymond <[email protected]>
Co-authored-by: Winnie Kiragu <[email protected]>
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

Successfully merging this pull request may close these issues.

Filtering Pending review status data using API does not return correct data
3 participants