diff --git a/keep/api/core/db.py b/keep/api/core/db.py index a7f74976ab..4092c756bc 100644 --- a/keep/api/core/db.py +++ b/keep/api/core/db.py @@ -575,7 +575,7 @@ def get_workflows_with_last_execution(tenant_id: str) -> List[dict]: ) .where(Workflow.tenant_id == tenant_id) .where(Workflow.is_deleted == False) - ) + ).distinct() result = session.execute(workflows_with_last_execution_query).all() diff --git a/tests/test_functions.py b/tests/test_functions.py index 44a113c335..d686b6e837 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -225,3 +225,11 @@ def test_encode(): def test_dict_to_key_value_list(): assert functions.dict_to_key_value_list({"a": 1, "b": "test"}) == ["a:1", "b:test"] + + +def test_slice(): + assert functions.slice("long string", 0, 4) == "long" + + +def test_slice_no_end(): + assert functions.slice("long string", 5) == "string"