diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d8a96964..b08ddf45 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -57,6 +57,10 @@ def require_pek_admin forbidden_page unless current_user.roles.pek_admin? end + def require_off_season + forbidden_page unless SystemAttribute.offseason? + end + def require_application_or_evaluation_season redirect_to root_url if SystemAttribute.offseason? end diff --git a/app/controllers/season_admin_controller.rb b/app/controllers/season_admin_controller.rb index 4abf3065..497dc471 100644 --- a/app/controllers/season_admin_controller.rb +++ b/app/controllers/season_admin_controller.rb @@ -1,5 +1,6 @@ class SeasonAdminController < ApplicationController before_action :require_rvt_leader + before_action :require_off_season, only: [:export_point_history, :export_active_users, :export_users_with_ab] def index @season = SystemAttribute.season diff --git a/app/services/export_active_users.rb b/app/services/export_active_users.rb index 3060709f..901563c4 100644 --- a/app/services/export_active_users.rb +++ b/app/services/export_active_users.rb @@ -12,9 +12,8 @@ def self.call(semester) def call result = [] result << ["Név","Email"] - users = User.includes(point_requests: :evaluation) - .where("evaluations.semester": [SystemAttribute.semester.previous.to_s, SystemAttribute.semester.to_s]) - .where("point_requests.point > 0") + users = User.joins(:point_history).where("point_histories.point > 0") + .where("point_histories.semester": [SystemAttribute.semester.previous.to_s, SystemAttribute.semester.to_s]) .order(:lastname).distinct users.each do |user| diff --git a/app/views/season_admin/index.html.erb b/app/views/season_admin/index.html.erb index b1393e52..f27268e9 100644 --- a/app/views/season_admin/index.html.erb +++ b/app/views/season_admin/index.html.erb @@ -42,8 +42,8 @@