Skip to content

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

Closed

Description

@Ayush5120

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")

Activity

  1. 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[/+] on Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions