Skip to content

Commit

Permalink
feature: removing debug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJaeger committed Aug 23, 2024
1 parent ebeb2f0 commit 0402d0f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
4 changes: 0 additions & 4 deletions insights/sources/flowruns/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,15 @@ def _base_operation(
return ["_search", {"size": 0, "query": self.validated_query, "aggs": aggs}]

def sum(self, op_field, *args, **kwargs):
print("op field", op_field)
return self._base_operation("sum", op_field)

def avg(self, op_field, *args, **kwargs):
print("op field", op_field)
return self._base_operation("avg", op_field)

def max(self, op_field, *args, **kwargs):
print("op field", op_field)
return self._base_operation("max", op_field)

def min(self, op_field, *args, **kwargs):
print("op field", op_field)
return self._base_operation("min", op_field)

def recurrence(self, op_field: str, limit: int = 100, *args, **kwargs):
Expand Down
2 changes: 0 additions & 2 deletions insights/widgets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ def is_configurable(self):
return self.dashboard.name != "Atendimento humano"

def source_config(self, sub_widget: str = None, is_live=False):
print("subwidte", sub_widget)
config = self.config if sub_widget is None else self.config[sub_widget]
print("config no source_config", config)
# default_filters, operation, op_field, limit
filters = config.get("filter", {})
if is_live:
Expand Down
12 changes: 1 addition & 11 deletions insights/widgets/usecases/get_source_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,15 @@ def __init__(self, operand_1, operand_2, operator) -> None:
self.operator = operator

def sum(self):
print("operadores", self.operand_1, self.operand_2, self.operator)
return self.operand_1 + self.operand_2

def sub(self):
print("operadores", self.operand_1, self.operand_2, self.operator)
return self.operand_1 - self.operand_2

def multiply(self):
print("operadores", self.operand_1, self.operand_2, self.operator)
return self.operand_1 * self.operand_2

def percentage(self):
print("operadores", self.operand_1, self.operand_2, self.operator)
return 100 * (self.operand_2 / self.operand_1)

def evaluate(self):
Expand All @@ -69,24 +65,19 @@ def simple_source_data_operation(
user_email: str = "",
):
query_kwargs = {}
print("filtro", filters)

# se entrar aqui pelo cross data, tirar o [0] pois isso gera erro no cross
# vc pode verificar se tem slug subwidget_1 or 2
sub = filters.pop("slug", [None])
if sub in ["subwidget_1", "subwidget_2"]:
default_filters, operation, op_field, op_sub_field, limit = (
widget.source_config(sub_widget=sub, is_live=is_live)
)
print("default filters", default_filters)
else:
default_filters, operation, op_field, op_sub_field, limit = (
widget.source_config(
sub_widget=filters.pop("slug", [None])[0], is_live=is_live
)
)

print("op field simple source", op_field)
default_filters.update(filters)

if is_live:
Expand Down Expand Up @@ -177,8 +168,7 @@ def get_source_data_from_widget(
raise Exception(
f"could not find a source with the slug {source}, make sure that the widget is configured with a supported source"
)
print(f"Widget: {widget}")
print(f"Widget is_crossing_data: {widget.is_crossing_data}")

operation_function = (
cross_source_data_operation
if widget.is_crossing_data
Expand Down

0 comments on commit 0402d0f

Please sign in to comment.