diff --git a/app/controllers/admins/nps_controller.rb b/app/controllers/admins/nps_controller.rb index bfb72f730..2817cd0c6 100644 --- a/app/controllers/admins/nps_controller.rb +++ b/app/controllers/admins/nps_controller.rb @@ -2,7 +2,7 @@ class Admins::NpsController < Admins::BaseController before_action :require_business def index @on_off_switch = EduSetting.get("nps-on-off-switch").to_s == 'true' - @user_nps = UserNp.joins(:user).order(created_at: :desc) + @user_nps = UserNp.order(created_at: :desc) keyword = params[:keyword].to_s.strip.presence if keyword sql = 'CONCAT(users.lastname, users.firstname) LIKE :keyword OR users.nickname LIKE :keyword OR users.login LIKE :keyword OR users.mail LIKE :keyword OR users.phone LIKE :keyword' diff --git a/app/views/admins/nps/_user_np_list.html.erb b/app/views/admins/nps/_user_np_list.html.erb index f2d5196e9..474fe8b86 100644 --- a/app/views/admins/nps/_user_np_list.html.erb +++ b/app/views/admins/nps/_user_np_list.html.erb @@ -12,15 +12,15 @@ <% if user_nps.present? %> <% user_nps.each_with_index do |nps, index| %> - + "> <%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to "/#{nps.user.login}", target: '_blank' do %> - <%= overflow_hidden_span nps.user.real_name, width: 100 %> + <%= link_to "/#{nps.user.nil? ? "用户已注销" : nps.user.login}", target: '_blank' do %> + <%= overflow_hidden_span (nps.user.nil? ? "用户已注销" : nps.user.real_name), width: 100 %> <% end %> <%= display_text(nps.created_at&.strftime('%Y-%m-%d %H:%M')) %> - <%= display_text(nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %> + <%= display_text(nps.user.nil? ? "用户已注销" : nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %> <%= nps.action_type == 'close' ? '--' : nps.score %> <%= nps.memo %>