From 7a5a26172800978e7f23d250a167d1467b2fc81c Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Tue, 25 Jul 2023 10:42:03 -0500 Subject: [PATCH] update show_time_spent boolean to keyword arg --- 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 c1463f5..e05be94 100644 --- a/app/serializers/user_classification_counts_serializer.rb +++ b/app/serializers/user_classification_counts_serializer.rb @@ -14,7 +14,7 @@ def as_json(options) response = { total_count: } calculate_time_spent(user_classification_counts, response) if show_time_spent show_proj_contributions(response, serializer_options[:top_project_contributions]) if serializer_options[:top_project_contributions] - response[:data] = response_data(user_classification_counts, serializer_options[:top_project_contributions], show_time_spent) if serializer_options[:period] + response[:data] = response_data(user_classification_counts, serializer_options[:top_project_contributions], show_time_spent:) if serializer_options[:period] response end @@ -25,7 +25,7 @@ def calculate_time_spent(counts, response) response[:time_spent] = total_time_spent end - def response_data(user_counts, num_top_projects, show_time_spent) + def response_data(user_counts, num_top_projects, show_time_spent:) # when calculating top projects, our records returned from query will be counts (and session time) per user per project bucketed by time # eg. { period: '01-01-2020', count: 38, project_id: 1 }, { period: '01-01-2020', count: 40, project_id: 2} # vs. Our desired response format which is counts (and session time) grouped by bucketed time. { period: '01-02-2020', count: 78 }