From 97935b13da2fcf7ec6e86e468cab8867ee67de0f Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Mon, 2 Oct 2023 14:49:35 -0500 Subject: [PATCH] update user classification counts so that if show_time_spent is false when filtering user classification counts by project, session_time is not returned as a key --- app/serializers/user_classification_counts_serializer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/serializers/user_classification_counts_serializer.rb b/app/serializers/user_classification_counts_serializer.rb index a4ec43d..b786c67 100644 --- a/app/serializers/user_classification_counts_serializer.rb +++ b/app/serializers/user_classification_counts_serializer.rb @@ -33,8 +33,8 @@ def response_data(user_counts, show_project_contributions:, show_time_spent:) if show_project_contributions counts_grouped_by_period = user_counts.group_by { |user_proj_class_count| user_proj_class_count[:period] }.transform_values do |counts_in_period| total_in_period = { count: counts_in_period.sum(&:count) } - total_in_period[:session_time] = counts_in_period.sum(&:session_time) if show_time_spent - total_in_period + total_in_period_session_time = { session_time: counts_in_period.sum(&:session_time) } if show_time_spent + show_time_spent ? total_in_period.merge(total_in_period_session_time) : total_in_period end counts_grouped_by_period.map { |period, totals| { period: }.merge(totals) } else