Skip to content

Commit

Permalink
update show_time_spent boolean to keyword arg
Browse files Browse the repository at this point in the history
  • Loading branch information
yuenmichelle1 committed Jul 25, 2023
1 parent 3c30f64 commit 7a5a261
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/serializers/user_classification_counts_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 }
Expand Down

0 comments on commit 7a5a261

Please sign in to comment.