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

Set default submission review status when enabled #1743

Closed
ivermac opened this issue Dec 11, 2019 · 6 comments · Fixed by #1749
Closed

Set default submission review status when enabled #1743

ivermac opened this issue Dec 11, 2019 · 6 comments · Fixed by #1749
Assignees
Labels

Comments

@ivermac
Copy link
Contributor

ivermac commented Dec 11, 2019

It would be nice if the data endpoint would return submission review status and submission review comments by default when the submission review feature has been enabled for a specific form. A suggestion would be to have the following when submission review has been enabled and the instance has no submission review because 3 is the code for Pending status:

...
_review_comment: ""
_review_status: "3"
...

This will also make it easier to filter data by submission review status especially when the data doesn't have a submission review. For example would work well:

"/api/v1/data?start=0&limit=100&query={"_review_status":"1"}"

Aha! Link: https://ona.aha.io/features/PROD-189

@DavisRayM
Copy link
Contributor

This may be quite painful to do for forms that already have preexisting instances. When the feature is enabled we would have to update all the .json values for the Instances as that's what is rendered and filtered on this endpoint.

@DavisRayM
Copy link
Contributor

@ivermac I think you're suggestion of just adding a not equal to filter on the endpoint would be good enough for the front end to distinguish what is Pending, I'll add that feature within the already opened PR #1749 .

@DavisRayM
Copy link
Contributor

Any opinions on this approach @ukanga ?

@ukanga
Copy link
Member

ukanga commented Dec 19, 2019

Perhaps we need to use constants, pending, reviewed and perhaps a top-level filter /api/v1/data/[form pk].json?review=pending which would translate to a _review_status=3 or _review_status is null query against the DB.

Currently, the way to achieve that is doing the same query for pending would be to use the construct:

/api/v1/data?start=0&limit=100&query={"$or": [{"_review_status":"1"}, {"_review_status": null}]}

Perhaps we may need to add a special case to handle when the field does not exist. Hence, maybe, having a review filter might give us that flexibility or an extension of the functionality in

if isinstance(query, dict) and '$or' in list(query):
.

@WNjihia
Copy link

WNjihia commented Jan 20, 2020

@DavisRayM I'm currently waiting for the fix for enabling submission reviews so I can be able to test this

@ivermac
Copy link
Contributor Author

ivermac commented Jan 21, 2020

@WNjihia Let's go ahead and test this using a tool like postman, curl or httpie. We need to make a request to the metadata endpoint to create the submission review then query the data endpoint using the query params mentioned in this PR

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

Successfully merging a pull request may close this issue.

4 participants