Merge pull request '调整nps统计' (#328) from KingChan/forgeplus:standalone_develop into standalone_develop

This commit is contained in:
KingChan 2025-01-23 10:05:59 +08:00
commit 00ec4a0ed8
2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@ class Admins::NpsController < Admins::BaseController
before_action :require_business before_action :require_business
def index def index
@on_off_switch = EduSetting.get("nps-on-off-switch").to_s == 'true' @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 keyword = params[:keyword].to_s.strip.presence
if keyword 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' 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'

View File

@ -12,15 +12,15 @@
<tbody> <tbody>
<% if user_nps.present? %> <% if user_nps.present? %>
<% user_nps.each_with_index do |nps, index| %> <% user_nps.each_with_index do |nps, index| %>
<tr class="user-item-<%= nps.user.id %>"> <tr class="user-item-<%= nps.user.nil? ? "用户已注销" : nps.user.id %>">
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td> <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td class="text-left"> <td class="text-left">
<%= link_to "/#{nps.user.login}", target: '_blank' do %> <%= link_to "/#{nps.user.nil? ? "用户已注销" : nps.user.login}", target: '_blank' do %>
<%= overflow_hidden_span nps.user.real_name, width: 100 %> <%= overflow_hidden_span (nps.user.nil? ? "用户已注销" : nps.user.real_name), width: 100 %>
<% end %> <% end %>
</td> </td>
<td><%= display_text(nps.created_at&.strftime('%Y-%m-%d %H:%M')) %></td> <td><%= display_text(nps.created_at&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= display_text(nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td> <td><%= display_text(nps.user.nil? ? "用户已注销" : nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= nps.action_type == 'close' ? '--' : nps.score %></td> <td><%= nps.action_type == 'close' ? '--' : nps.score %></td>
<td><%= nps.memo %></td> <td><%= nps.memo %></td>
</tr> </tr>