diff --git a/api/chalicelib/core/metrics/product_analytics.py b/api/chalicelib/core/metrics/product_analytics.py index 934cd33ad..ffa4fd319 100644 --- a/api/chalicelib/core/metrics/product_analytics.py +++ b/api/chalicelib/core/metrics/product_analytics.py @@ -11,9 +11,6 @@ logger = logging.getLogger(__name__) def __transform_journey(rows, reverse_path=False): - print("---------------------------------") - print(rows) - print("---------------------------------") total_100p = 0 number_of_step1 = 0 for r in rows: @@ -32,17 +29,21 @@ def __transform_journey(rows, reverse_path=False): source = f"{r['event_number_in_session']}_{r['event_type']}_{r['e_value']}" if source not in nodes: nodes.append(source) - nodes_values.append({"name": r['e_value'], "eventType": r['event_type']}) + nodes_values.append({"depth": r['event_number_in_session'] - 1, + "name": r['e_value'], + "eventType": r['event_type']}) # if r['next_value']: target = f"{r['event_number_in_session'] + 1}_{r['next_type']}_{r['next_value']}" if target not in nodes: nodes.append(target) - nodes_values.append({"name": r['next_value'], "eventType": r['next_type']}) + nodes_values.append({"depth": r['event_number_in_session'], + "name": r['next_value'], + "eventType": r['next_type']}) sr_idx = nodes.index(source) tg_idx = nodes.index(target) - link = {"eventType": r['event_type'], "sessionsCount": r["sessions_count"],"value": r["value"]} + link = {"eventType": r['event_type'], "sessionsCount": r["sessions_count"], "value": r["value"]} if not reverse_path: link["source"] = sr_idx link["target"] = tg_idx diff --git a/api/chalicelib/core/metrics/product_analytics_ch.py b/api/chalicelib/core/metrics/product_analytics_ch.py index d4f3a4432..4c5f3334d 100644 --- a/api/chalicelib/core/metrics/product_analytics_ch.py +++ b/api/chalicelib/core/metrics/product_analytics_ch.py @@ -253,7 +253,7 @@ FROM ( SELECT others_n.event_number_in_session, 'OTHER' AS event_type, NULL AS e_value, - 'OTHERS' AS next_type, + 'OTHER' AS next_type, NULL AS next_value, SUM(sessions_count) AS sessions_count FROM others_n