From 591399eabaee2523201e32f8190c9b801bf00aaa Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Tue, 22 Aug 2023 21:45:44 +0800 Subject: [PATCH] Fix bug. --- app/controllers/admin/ruling_timers_controller.rb | 2 +- config/routes.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/ruling_timers_controller.rb b/app/controllers/admin/ruling_timers_controller.rb index a53baaa..3aa41c1 100644 --- a/app/controllers/admin/ruling_timers_controller.rb +++ b/app/controllers/admin/ruling_timers_controller.rb @@ -47,7 +47,7 @@ class Admin::RulingTimersController < OrbitMemberController end def timer_management @timer_temps = RulingTimerTemp.all.page(params[:page]).per(15) - @active_users = @timer_temps.map{|t| t.user} + @active_users = @timer_temps.map{|t| t.user}.compact end def task_management @tasks = RulingTimerTask.all.desc(:created_at).page(params[:page]).per(10) diff --git a/config/routes.rb b/config/routes.rb index 90c6d9e..a952669 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,6 +51,11 @@ Rails.application.routes.draw do category.title_translations = I18n.available_locales.map{|l| [l.to_s,I18n.with_locale(l){I18n.t("ruling_timer.personal_project")}]}.to_h category.save end + RulingTimerTemp.all.to_a.each do |t| + if t.user.nil? + t.destroy + end + end rescue => e puts e.to_s end