From 948537173f811d30a38100b2ac6de212857b13dd Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 23 Jul 2019 14:31:11 +0800 Subject: [PATCH 1/3] fix library download count bug --- app/controllers/libraries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index b7bbf836..ac861841 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -23,7 +23,7 @@ class LibrariesController < ApplicationController per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i @libraries = paginateHelper libraries.includes(:library_tags, :praise_tread_cache, user: :user_extensions), per_page - @download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).count + @download_count_map = Attachment.where(container_type: 'Library', container_id: @libraries.map(&:id)).group(:container_id).sum(:downloads) end def show From 85ddabac8d0a8b6f5bd3a9fa1240b6d6e0dbf6d9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 23 Jul 2019 18:06:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=90=86=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/user_agent.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/user_agent.rake b/lib/tasks/user_agent.rake index f3f4dd23..c240a66f 100644 --- a/lib/tasks/user_agent.rake +++ b/lib/tasks/user_agent.rake @@ -24,7 +24,7 @@ namespace :sync do team_member = TeamMember.find_by_user_id(user_action.try(:user_id)) if team_member # 即代理之前报名的 - if team_member.created_on < ua.created_at + if team_member.created_at < ua.created_at params = params.merge(:action_status => 1) else # 代理之后报名的 From d3b52b8653972c6ae9409fbaaea69a405642ad5b Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 23 Jul 2019 18:08:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E6=88=90=E7=BB=A9=E4=B8=8D=E5=8F=97=E5=BD=B1?= =?UTF-8?q?=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/user_agent.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/user_agent.rake b/lib/tasks/user_agent.rake index c240a66f..b80a6fb4 100644 --- a/lib/tasks/user_agent.rake +++ b/lib/tasks/user_agent.rake @@ -31,7 +31,9 @@ namespace :sync do params = params.merge(:action_status => 2) end end - ua.update_attributes(params) + if ua.action_status != 2 # 代理成功报名的成绩不受影响 + ua.update_attributes(params) + end end end end \ No newline at end of file