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

RESTWS-923: Filter out retired forms in /forms endpoint #592

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.EncounterType;
import org.openmrs.Field;
import org.openmrs.Form;
import org.openmrs.FormField;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
Expand Down Expand Up @@ -194,7 +197,11 @@ protected NeedsPaging<Form> doGetAll(RequestContext context) throws ResponseExce
*/
@Override
protected NeedsPaging<Form> doSearch(RequestContext context) {
return new NeedsPaging<Form>(Context.getFormService().getForms(context.getParameter("q"), false), context);
String fuzzyName = context.getParameter("q");
Copy link
Member

Choose a reason for hiding this comment

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

You do not even need these variables. You can just directly use the context calls in the getForms API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but to be readable and easy to understand at a glance I thought of extracting the to variables.

boolean includeRetired = context.getIncludeAll();

return new NeedsPaging<Form>(Context.getFormService().getForms(fuzzyName, null, null,
includeRetired, null, null, null), context);
}

/**
Expand Down
Loading