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 likefilter_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}"}
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:
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:and,
filter_dict["user_id"] = kwargs.get("user_id")