From c5b4510b23d5b52685acdc10c957166b56724f1c Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 11 Jan 2021 14:38:19 +0100 Subject: [PATCH] Use count to get number of study groups --- app/controllers/exercises_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index cc11c72b..b4aa8073 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -498,7 +498,7 @@ class ExercisesController < ApplicationController user_statistics = {} additional_filter = if policy(@exercise).detailed_statistics? '' - elsif ! policy(@exercise).detailed_statistics? && current_user.study_groups > 0 + elsif ! policy(@exercise).detailed_statistics? && current_user.study_groups.count > 0 "AND study_group_id IN (#{current_user.study_groups.pluck(:id).join(', ')}) AND cause = 'submit'" else # e.g. internal user without any study groups, show no submissions