fix: issue filtering keyerror (#494)

This commit is contained in:
pablohashescobar 2023-03-24 00:13:05 +05:30 committed by GitHub
parent 2501c819d3
commit 053ae2063e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ def filter_state(params, filter, method):
if len(states) and "" not in states:
filter["state__in"] = states
else:
if len(params.get("state")):
if params.get("state", None) and len(params.get("state")):
filter["state__in"] = params.get("state")
return filter
@ -19,7 +19,7 @@ def filter_priority(params, filter, method):
if len(priorties) and "" not in priorties:
filter["priority__in"] = priorties
else:
if len(params.get("priority")):
if params.get("priority", None) and len(params.get("priority")):
filter["priority__in"] = params.get("priority")
return filter
@ -30,7 +30,7 @@ def filter_parent(params, filter, method):
if len(parents) and "" not in parents:
filter["parent__in"] = parents
else:
if len(params.get("parent")):
if params.get("parent", None) and len(params.get("parent")):
filter["parent__in"] = params.get("parent")
return filter
@ -41,7 +41,7 @@ def filter_labels(params, filter, method):
if len(labels) and "" not in labels:
filter["labels__in"] = labels
else:
if len(params.get("labels")):
if params.get("labels", None) and len(params.get("labels")):
filter["labels__in"] = params.get("labels")
return filter
@ -52,7 +52,7 @@ def filter_assignees(params, filter, method):
if len(assignees) and "" not in assignees:
filter["assignees__in"] = assignees
else:
if len(params.get("assignees")):
if params.get("assignees", None) and len(params.get("assignees")):
filter["assignees__in"] = params.get("assignees")
return filter
@ -63,7 +63,7 @@ def filter_created_by(params, filter, method):
if len(created_bys) and "" not in created_bys:
filter["created_by__in"] = created_bys
else:
if len(params.get("created_by")):
if params.get("created_by", None) and len(params.get("created_by")):
filter["created_by__in"] = params.get("created_by")
return filter
@ -85,7 +85,7 @@ def filter_created_at(params, filter, method):
else:
filter["created_at__date__lte"] = created_at_query[0]
else:
if len(params.get("created_at")):
if params.get("created_at", None) and len(params.get("created_at")):
for query in params.get("created_at"):
if query.get("timeline", "after") == "after":
filter["created_at__date__gte"] = query.get("datetime")
@ -105,7 +105,7 @@ def filter_updated_at(params, filter, method):
else:
filter["updated_at__date__lte"] = updated_at_query[0]
else:
if len(params.get("updated_at")):
if params.get("updated_at", None) and len(params.get("updated_at")):
for query in params.get("updated_at"):
if query.get("timeline", "after") == "after":
filter["updated_at__date__gte"] = query.get("datetime")
@ -125,7 +125,7 @@ def filter_start_date(params, filter, method):
else:
filter["start_date__date__lte"] = start_date_query[0]
else:
if len(params.get("start_date")):
if params.get("start_date", None) and len(params.get("start_date")):
for query in params.get("start_date"):
if query.get("timeline", "after") == "after":
filter["start_date__date__gte"] = query.get("datetime")
@ -145,7 +145,7 @@ def filter_target_date(params, filter, method):
else:
filter["target_date__date__lte"] = target_date_query[0]
else:
if len(params.get("target_date")):
if params.get("target_date", None) and len(params.get("target_date")):
for query in params.get("target_date"):
if query.get("timeline", "after") == "after":
filter["target_date__date__gte"] = query.get("datetime")
@ -166,7 +166,7 @@ def filter_completed_at(params, filter, method):
else:
filter["completed_at__lte"] = completed_at_query[0]
else:
if len(params.get("completed_at")):
if params.get("completed_at", None) and len(params.get("completed_at")):
for query in params.get("completed_at"):
if query.get("timeline", "after") == "after":
filter["completed_at__date__gte"] = query.get("datetime")