操作记录后台查询菜单

This commit is contained in:
xxq250 2024-09-27 09:55:53 +08:00
parent 2381851c88
commit 29ee61ab1b
3 changed files with 9 additions and 26 deletions

View File

@ -14,7 +14,7 @@
<tbody>
<% if user_actions.present? %>
<% user_actions.each_with_index do |action, index| %>
<tr class="user-item-<%= action.user.id %>">
<tr class="user-item-<%= action.user&.id %>">
<td class="text-center"><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td><%= action.action_name %></td>
<td>

View File

@ -13,24 +13,7 @@
<% end %>
</div>
<!--<div class="box py-0 pt-4 pl-4 daily-school-statistic-title" >-->
<!-- <p style="font-weight: bold">数据统计:</p>-->
<!-- <p>-->
<!-- 评分用户数/用户总数:<span class="text-danger"><%#= @score_total_count %>/<%#= UserNp.count %></span>-->
<!-- 平均评分:<span class="text-danger"><%#= UserNp.where("action_type !='close'").average(:score).to_f.round(1) %></span>-->
<%# @user_nps_mid = @score_total_count % 2 == 0 ? @score_total_count / 2 : (@score_total_count + 1) / 2 %>
<!-- 评分中位数:<span class="text-danger"><%#= UserNp.where("action_type !='close'").order("score").pluck(:score)[@user_nps_mid - 1].to_i %></span>-->
<!-- 最低评分/评分人数:<span class="text-danger"><%#=@min_score.to_i %>/<%#= UserNp.where("action_type !='close'").where(score: @min_score).count %></span>-->
<!-- 最高评分/评分人数:<span class="text-danger"><%#=@max_score.to_i %>/<%#= UserNp.where("action_type !='close'").where(score: @max_score).count %></span>-->
<!-- </p>-->
<!-- <p style="padding-bottom: 10px !important;">-->
<!-- 填写意见用户数/用户总数:<span class="text-danger"><%#= UserNp.where("LENGTH(memo) >0").count %>/<%#= UserNp.count %></span>-->
<!-- 期待更加丰富的功能:<span class="text-danger"><%#= UserNp.where("memo like '%期待更加丰富的功能%'").count %></span>-->
<!-- 希望有新手引导:<span class="text-danger"><%#= UserNp.where("memo like '%希望有新手引导%'").count %></span>-->
<!-- 提升用户体验:<span class="text-danger"><%#= UserNp.where("memo like '%用户体验需进一步提升%'").count %></span>-->
<!-- 其他:<span class="text-danger"><%#= UserNp.where("action_type !='close'").where("LENGTH(memo) >0").where.not(id: UserNp.where("memo like '%期待更加丰富的功能%' or memo like '%希望有新手引导%' or memo like '%用户体验需进一步提升%' ").ids).count %></span>-->
<!-- </p>-->
<!--</div>-->
<div class="box admin-list-container users-list-container">
<%= render partial: 'admins/user_actions/user_action_list', locals: { user_actions: @user_actions } %>
</div>

View File

@ -7,14 +7,14 @@ class AddUserInfoToUserActions < ActiveRecord::Migration[5.2]
UserAction.find_in_batches(batch_size: 1000) do |sw|
Parallel.each(sw, in_threads: 5) do |user_action|
next if user_action.user_id.blank?
user = User.find_by(id: user_action.user_id)
next if user.blank?
user_action.login = user.login
user_action.email = user.mail
user_action.phone = user.phone
user_action.save
if user_action.user.present?
user_action.login = user_action.user&.login
user_action.email = user_action.user&.mail
user_action.phone = user_action.user&.phone
user_action.save
end
end
end
end
end