From 6d7b7dd0588c4628060ae7cc122aea21387abfd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Mon, 19 Sep 2022 10:06:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fixed=20=E4=BF=AE=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 531095b4b..e7b5af5d3 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -111,7 +111,9 @@ class AccountsController < ApplicationController sync_params = { password: params[:password].to_s, - email: @user.mail + email: @user.mail, + login_name: @user.login, + source_id: 0 } interactor = Gitea::User::UpdateInteractor.call(@user.login, sync_params) From bb8e6aeaf8d3581a6f6f3895c2a31016b08dfef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Tue, 20 Sep 2022 09:41:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?nps=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/nps_controller.rb | 3 +++ app/views/admins/nps/index.html.erb | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/controllers/admins/nps_controller.rb b/app/controllers/admins/nps_controller.rb index 491e62778..8b3d828ff 100644 --- a/app/controllers/admins/nps_controller.rb +++ b/app/controllers/admins/nps_controller.rb @@ -8,6 +8,9 @@ class Admins::NpsController < Admins::BaseController @user_nps = @user_nps.where(sql, keyword: "%#{keyword}%") end @user_nps = @user_nps.where("action_type != 'close'") if params[:done_score].present? + @min_score = @user_nps.where("action_type != 'close'").minimum("score") + @max_score = @user_nps.where("action_type != 'close'").maximum("score") + @score_total_count = UserNp.where("action_type !='close'").count @user_nps = paginate @user_nps.includes(:user) end diff --git a/app/views/admins/nps/index.html.erb b/app/views/admins/nps/index.html.erb index cc3eb94ad..5c083f33c 100644 --- a/app/views/admins/nps/index.html.erb +++ b/app/views/admins/nps/index.html.erb @@ -13,12 +13,31 @@ <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> NPS系统开关 - checked<%end %> data-toggle="toggle" data-onstyle="primary" id="nps_toggle" data-on="开" data-off="关" data-size="small"> + checked + <% end %> data-toggle="toggle" data-onstyle="primary" id="nps_toggle" data-on="开" data-off="关" data-size="small"> <% end %> - +
+

数据统计:

+

+ 评分用户数/用户总数:<%= @score_total_count %>/<%= UserNp.count %>, + 平均评分:<%= UserNp.where("action_type !='close'").average(:score).to_f.round(1) %>, + <% @user_nps_mid = @score_total_count % 2 == 0 ? @score_total_count / 2 : (@score_total_count + 1) / 2 %> + 评分中位数:<%= UserNp.where("action_type !='close'").order("score").pluck(:score)[@user_nps_mid - 1].to_i %>, + 最低评分/评分人数:<%=@min_score.to_i %>/<%= UserNp.where("action_type !='close'").where(score: @min_score).count %>, + 最高评分/评分人数:<%=@max_score.to_i %>/<%= UserNp.where("action_type !='close'").where(score: @max_score).count %> +

+

+ 填写意见用户数/用户总数:<%= UserNp.where("memo is not null").count %>/<%= UserNp.count %>, + 期待更加丰富的功能:<%= UserNp.where("memo like '%期待更加丰富的功能%'").count %>, + 希望有新手引导:<%= UserNp.where("memo like '%希望有新手引导%'").count %>, + 提升用户体验:<%= UserNp.where("memo like '%用户体验需进一步提升%'").count %>, + 其他:<%= UserNp.where("memo is not null").where.not(id: UserNp.where("memo like '%期待更加丰富的功能%' or memo like '%希望有新手引导%' or memo like '%用户体验需进一步提升%' ").ids).count %> +

+
<%= render partial: 'admins/nps/user_np_list', locals: { user_nps: @user_nps } %>