From 5d4852244a333b88a3a55dbe528a0568db28216d Mon Sep 17 00:00:00 2001 From: SepsiLaszlo Date: Sun, 29 Dec 2024 13:49:07 +0100 Subject: [PATCH] cleanup exports --- app/controllers/application_controller.rb | 4 ++++ app/controllers/season_admin_controller.rb | 1 + app/services/export_active_users.rb | 5 ++--- app/views/season_admin/index.html.erb | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) 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 @@

Közösségi Pont Export

@@ -57,9 +57,9 @@

Általános Belépőt Kapott Felhasználók Export

    +
  • Ez a lehetőség csak Nyugalmi Időszakban érhető el, amikor a belépők már elbírálásra kerültek.
  • Az aktuálisan kiválasztott félévre vonatkozik.
  • Ha egy felhasználó több körből is kapott színesbelépőt, akkor több sorban is megjelenik.
  • -
  • A színes belépők véglegesítése után és a következő félév beállítása előtt célszerű elkészíteni.
  • Az ÁB Osztó meghívó email-ek kiküldésekor hasznos.
<% if SystemAttribute.offseason? && PointHistory.exists?(semester: @semester.to_s) %> @@ -72,6 +72,7 @@

Aktív Felhasználók Export

    +
  • Ez a lehetőség csak Nyugalmi Időszakban érhető el, amikor a pontozások már véglegesek.
  • Az aktuális és előző félév valamelyikében közösségi pontot szerző felhasználók exportja.
  • A színes belépők véglegesítése után és a következő félév beállítása előtt célszerű elkészíteni.
  • A kozelet@sch.bme.hu levelző list frissentartásához készült.