Skip to content

Commit 81c80cf

Browse files
authored
Merge pull request #471 from techpixel/filter-by-category
allow filtering by category on the stats endpoint
2 parents f9bf2dc + f09c6a3 commit 81c80cf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/controllers/api/v1/stats_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ def user_stats
8282
query = query.where(project: filter_by_project)
8383
end
8484

85+
if params[:filter_by_category].present?
86+
filter_by_category = params[:filter_by_category].split(",")
87+
query = query.where(category: filter_by_category)
88+
end
89+
8590
# do the boundary thingie if requested
8691
use_boundary_aware = params[:boundary_aware] == "true"
8792
total_seconds = if use_boundary_aware

0 commit comments

Comments
 (0)