Skip to content

Commit

Permalink
feat: add isnull operation
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed Jun 13, 2024
1 parent 6b20056 commit 755c044
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions insights/dashboards/usecases/dashboard_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def create_widgets(self, dashboard_atendimento_humano):
config={
"operation": "count",
"type_result": "executions",
"filter": {"is_active": True, "attending": True},
"filter": {"is_active": True, "user_id__isnull": True},
},
dashboard=dashboard_atendimento_humano,
position={"rows": [2, 2], "columns": [1, 4]},
Expand Down Expand Up @@ -82,7 +82,7 @@ def create_widgets(self, dashboard_atendimento_humano):
config={
"operation": "avg",
"type_result": "executions",
"op_field": "response_time",
"op_field": "message_response_time",
},
dashboard=dashboard_atendimento_humano,
position={"rows": [3, 3], "columns": [1, 4]},
Expand All @@ -96,7 +96,7 @@ def create_widgets(self, dashboard_atendimento_humano):
"type_result": "executions",
"filter": {
"is_active": True,
"attending": False,
"user_id__isnull": False,
},
},
dashboard=dashboard_atendimento_humano,
Expand Down
4 changes: 4 additions & 0 deletions insights/sources/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def apply(self, field, operation, value, table_alias):
return f"{table_alias}.{field} IN ({placeholders})", list(value)
elif operation == "icontains":
return f"{table_alias}.{field} ILIKE (%s)", [f"%{value}%"]
elif operation == "isnull":
return f"{table_alias}.{field} IS (%s) NULL", [
"NOT" if value is True else ""
]
elif operation == "or":
if type(field) is not dict:
raise ValueError(
Expand Down

0 comments on commit 755c044

Please sign in to comment.