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

fix: Handle None Values Correctly in List Task Endpoint Query Filter #177

Closed
Ayush5120 opened this issue Jun 12, 2024 · 0 comments · Fixed by #178
Closed

fix: Handle None Values Correctly in List Task Endpoint Query Filter #177

Ayush5120 opened this issue Jun 12, 2024 · 0 comments · Fixed by #178

Comments

@Ayush5120
Copy link
Contributor

When building the query filter with potential None values for name_prefix and user_id, the filter should be adjusted accordingly to avoid incorrect queries.

Expected Behavior:

  • If name_prefix is None, filter_dict should be empty ({}).
  • If user_id is None, it should not be added to the filter.

Actual Behavior:
Currently, if name_prefix is None, the filter becomes:
filter_dict = {'task_original.name': {'$regex': '^None'}}

while in the case of None Type the filter_dict should be empty like filter_dict = {}
The actual issue is here:

        name_prefix: str = str(kwargs.get("name_prefix"))

        if name_prefix is not None:
            filter_dict["task_original.name"] = {"$regex": f"^{name_prefix}"}

and,
filter_dict["user_id"] = kwargs.get("user_id")

@Ayush5120 Ayush5120 changed the title fix: Handle None Values Correctly in Get Task Endpoint Query Filter fix: Handle None Values Correctly in List Task Endpoint Query Filter Jun 12, 2024
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 a pull request may close this issue.

1 participant