From 62ec33c6b5fd6579550153d9a7adcf4e95e344a4 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Wed, 23 Mar 2022 19:08:52 +0100 Subject: [PATCH] feat(api): changed funnels drop percentage formula --- api/chalicelib/core/funnels.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/chalicelib/core/funnels.py b/api/chalicelib/core/funnels.py index 0b49037e6..3ae31f5e4 100644 --- a/api/chalicelib/core/funnels.py +++ b/api/chalicelib/core/funnels.py @@ -241,6 +241,10 @@ def get_top_insights_on_the_fly(funnel_id, user_id, project_id, data: schemas.Fu data.events = __fix_stages(data.events) insights, total_drop_due_to_issues = significance.get_top_insights(filter_d=data.dict(), project_id=project_id) if len(insights) > 0: + # fix: this fix for huge drop count + if total_drop_due_to_issues > insights[0]["sessionsCount"]: + total_drop_due_to_issues = insights[0]["sessionsCount"] + # end fix insights[-1]["dropDueToIssues"] = total_drop_due_to_issues return {"data": {"stages": helper.list_to_camel_case(insights), "totalDropDueToIssues": total_drop_due_to_issues}}