Add access to statistics for users

This commit is contained in:
Sebastian Serth
2019-11-29 15:40:21 +01:00
parent ab96fb92c2
commit 96c90d0a62
2 changed files with 3 additions and 3 deletions

View File

@ -3,11 +3,11 @@ class ExercisePolicy < AdminOrAuthorPolicy
admin? admin?
end end
[:show?, :study_group_dashboard?, :feedback?, :requests_for_comments?].each do |action| [:show?, :study_group_dashboard?, :feedback?, :requests_for_comments?, :statistics?].each do |action|
define_method(action) { admin? || teacher? } define_method(action) { admin? || teacher? }
end end
[:clone?, :destroy?, :edit?, :statistics?, :update?].each do |action| [:clone?, :destroy?, :edit?, :update?].each do |action|
define_method(action) { admin? || author? } define_method(action) { admin? || author? }
end end

View File

@ -24,7 +24,7 @@ h1 = @exercise
= row(label: '.average_worktime') do = row(label: '.average_worktime') do
p = @exercise.average_working_time p = @exercise.average_working_time
- Hash[:internal_users => t('.internal_users'), :external_users => t('.external_users')].each_pair do |symbol, label| - Hash[:internal_users => t('.internal_users'), :external_users => t('.external_users')].each_pair if current_user.admin? do |symbol, label|
strong = label strong = label
-if symbol==:external_users -if symbol==:external_users
-working_time_array = [] -working_time_array = []