From 739e560a405d12af48f577516ab359195e5cba0e Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 6 Mar 2019 21:40:52 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index d1281338..b56e537b 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -1,7 +1,7 @@ # encoding: utf-8 class ChallengesController < ApplicationController layout "base_shixun" - before_filter :check_authentication + before_filter :check_authentication, :except => [:index] before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question, :choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose] before_filter :find_challenge, :only => [:show, :edit, :update, :challenge_build, :index_up, :index_down, :destroy, :update_evaluation, :add_choose_question, From 432fc2f4155ad0f481c67c39ae89e3837b6441e0 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 7 Mar 2019 12:22:24 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=BB=E7=B1=BB=E5=88=AB=E5=92=8C=E5=B0=8F=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e6645b3f..b4b156a0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -240,7 +240,7 @@ module ApplicationHelper container = [] mirror_repositories.each do |mr| if mr.name.present? - container << {:image => mr.name, :cpuLimit => mr.cpu_limit, :memoryLimit => "#{mr.memory_limit}M"} + container << {:image => mr.name, :cpuLimit => mr.cpu_limit, :memoryLimit => "#{mr.memory_limit}M", :type => mr.try(:main_type) == "1" ? "main" : "sub"} end end return container.to_json From 92e150105770232fe1a39014a10caca0a5e9d9e3 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 7 Mar 2019 17:41:37 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=9A=82=E5=81=9C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=94=B9=E4=B8=BA3=E6=9C=888=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index b2667a27..a6bf6ab6 100644 --- a/public/update.html +++ b/public/update.html @@ -56,7 +56,7 @@ If you continue to experience problems please contact your Trustie administrator 温馨提示:为了给大家提供更优质的服务

- 平台拟于2019年3月7日00:00--8:00进行全面升级,带来不便,敬请谅解! + 平台拟于2019年3月8日00:00--8:00进行全面升级,带来不便,敬请谅解!

From 729c079738900616811209a3c8f9274ae4b3b273 Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Fri, 8 Mar 2019 12:16:18 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=88=A0=E9=99=A4gpid=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84myshixun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- lib/tasks/delete_error_myshixun.rake | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 lib/tasks/delete_error_myshixun.rake diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f147b9b2..e50827e3 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -384,7 +384,7 @@ class ShixunsController < ApplicationController shixun_id = shixun_id & my_shixun_ids end - @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text]).where(:id => shixun_id, :hidden => 0, :trainee => diff, :status => status).includes(:challenges, :schools, :shixun_members, :users) + @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:id => shixun_id, :hidden => 0, :trainee => diff, :status => status).includes(:challenges, :schools, :shixun_members, :users) if search.present? search_users_id = User.select([:id]).where("concat(lastname, firstname) like '%#{search}%'") diff --git a/lib/tasks/delete_error_myshixun.rake b/lib/tasks/delete_error_myshixun.rake new file mode 100644 index 00000000..269b4536 --- /dev/null +++ b/lib/tasks/delete_error_myshixun.rake @@ -0,0 +1,11 @@ +namespace :myshixun do + desc "delete gpid is no" + task :delete_error_myshixuns => :environment do + begin + myshixuns = Myshixun.where(gpid: nil) + myshixuns.delete_all + rescue Exception => e + puts e + end + end +end From 5a41e4a15f2c616703f4463369194fa096a029fb Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Fri, 8 Mar 2019 12:26:29 +0800 Subject: [PATCH 05/13] 1 --- lib/tasks/delete_error_myshixun.rake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tasks/delete_error_myshixun.rake b/lib/tasks/delete_error_myshixun.rake index 269b4536..b9165a73 100644 --- a/lib/tasks/delete_error_myshixun.rake +++ b/lib/tasks/delete_error_myshixun.rake @@ -2,8 +2,11 @@ namespace :myshixun do desc "delete gpid is no" task :delete_error_myshixuns => :environment do begin - myshixuns = Myshixun.where(gpid: nil) - myshixuns.delete_all + myshixuns = Myshixun.where("gpid is null and created_at > '#{Time.now.beginning_of_day}'") + myshixuns.find_each do |m| + m.destroy + puts("#myshixun_id: #{m.id}") + end rescue Exception => e puts e end From e764011fcaf89c7faa3db8ee24926ba80837af09 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 Mar 2019 14:39:28 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E5=A0=82500?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 58aa90f0..b6207fd3 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -82,7 +82,10 @@ <%= link_to "开始实战", shixun_path(activity.homework_commons_shixuns.shixun), :class => 'edu-filter-btn edu-activity-blue ml15 fl mt5', :target => "_blank" %> <% elsif work.present? %> <% myshixun = Myshixun.where(:id => work.myshixun_id).first %> - <% is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => myshixun.shixun.try(:id), :status => 1).first %> + <% if myshixun.present? %> + <% is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => myshixun.shixun.try(:id), :status => 1).first %> + <% end %> + <% if myshixun && is_modify.blank? %> <%= link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %> <% elsif myshixun %> From 61dbb622d6aaf118575b5e68c4b3c0325b0ac6f9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 Mar 2019 14:42:37 +0800 Subject: [PATCH 07/13] =?UTF-8?q?500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 03507d8c..5f521117 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -83,7 +83,10 @@ <% elsif work.present? %> <% myshixun = Myshixun.where(:id => work.myshixun_id).first %> <%# is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => myshixun.shixun.try(:id), :status => 1).first %> - <%= link_to "继续实战", shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %> + <% if myshixun.present? %> + <%= link_to "继续实战", shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %> + <% end %> + <%# if myshixun && is_modify.blank? %> <%#= link_to "继续实战", shixun_exec_shixun_path(myshixun.shixun), :class => "edu-filter-btn edu-activity-blue ml15 fl mt5", :target => "_blank" %> <%# elsif myshixun %> From 5e029c5e67728a58d6c0cfd8ef279982d22289c6 Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Fri, 8 Mar 2019 17:10:36 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_item.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/subjects/_subject_item.html.erb b/app/views/subjects/_subject_item.html.erb index abcf0f11..d3ac4ebf 100644 --- a/app/views/subjects/_subject_item.html.erb +++ b/app/views/subjects/_subject_item.html.erb @@ -1,19 +1,19 @@ -<% result = User.current.is_certification_teacher || User.current.admin? %> +<% result = User.current.is_certification_teacher || User.current.member_of_subject?(subject) %> <% subjects.each do |subject| %>
<% if subject.repertoire.present? %>
<%= subject.repertoire.name %>
<% end %> - <% unless result %> + <% if subject.status < 2 && !result %>

暂未开发

<% end %> - " class="square-img" target="_blank"><%= image_tag(url_to_avatar(subject)) %> + " class="square-img" target="_blank"><%= image_tag(url_to_avatar(subject)) %>

- <%= link_to subject.name, "#{result ? subject_path(subject) : "javascript:void(0);"}", :class => "justify color-grey-name", :target => "_blank" %> + <%= link_to subject.name, "#{ result || subject.status >= 2 ? subject_path(subject) : "javascript:void(0);"}", :class => "justify color-grey-name", :target => "_blank" %>

<% if subject.stages_count > 0 %> From 3f09af9dbb40268e0636e77b2c66d4136f6e4809 Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Fri, 8 Mar 2019 17:18:18 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_item.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/subjects/_subject_item.html.erb b/app/views/subjects/_subject_item.html.erb index d3ac4ebf..3dbc3605 100644 --- a/app/views/subjects/_subject_item.html.erb +++ b/app/views/subjects/_subject_item.html.erb @@ -1,19 +1,18 @@ -<% result = User.current.is_certification_teacher || User.current.member_of_subject?(subject) %> <% subjects.each do |subject| %>

<% if subject.repertoire.present? %>
<%= subject.repertoire.name %>
<% end %> - <% if subject.status < 2 && !result %> + <% if params[:controller] != "welcome" && subject.status < 2 && !User.current.member_of_subject?(subject) %>

暂未开发

<% end %> - " class="square-img" target="_blank"><%= image_tag(url_to_avatar(subject)) %> + <%= image_tag(url_to_avatar(subject)) %>

- <%= link_to subject.name, "#{ result || subject.status >= 2 ? subject_path(subject) : "javascript:void(0);"}", :class => "justify color-grey-name", :target => "_blank" %> + <%= link_to subject.name, subject_path(subject), :class => "justify color-grey-name", :target => "_blank" %>

<% if subject.stages_count > 0 %> From b2db87cb02ac02c638c6a8b79351634c1156cdd1 Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Sat, 9 Mar 2019 09:11:27 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_shixun_item.html.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/shixuns/_shixun_item.html.erb b/app/views/shixuns/_shixun_item.html.erb index 40420a8b..f4234b7f 100644 --- a/app/views/shixuns/_shixun_item.html.erb +++ b/app/views/shixuns/_shixun_item.html.erb @@ -1,21 +1,21 @@ -<% result = User.current.is_certification_teacher || User.current.admin? %> +<%# result = User.current.is_certification_teacher || User.current.admin? %> <% shixuns.each do |shixun| %>

<% if shixun.tag_repertoires.first.present? %>
<%= shixun.tag_repertoires.first.try(:name) %>
<% end %> - <% unless result %> -
- -

暂未公开

-
+ <% if params[:controller] != "welcome" && shixun_view_allow(shixun, true) %> +
+ +

暂未公开

+
<% end %> " class="square-img" target="_blank"> <%= image_tag(url_to_avatar(shixun)) %>

- " class="justify color-grey-name" title="<%= shixun.name %>" target="_blank"><%= shixun.name %> + <%= shixun.name %>

From 4fe0bdb62030d471c29753dfe07714c82a53bfef Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Sat, 9 Mar 2019 09:14:45 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=97=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_shixun_item.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shixuns/_shixun_item.html.erb b/app/views/shixuns/_shixun_item.html.erb index f4234b7f..f3677a27 100644 --- a/app/views/shixuns/_shixun_item.html.erb +++ b/app/views/shixuns/_shixun_item.html.erb @@ -10,12 +10,12 @@

暂未公开

<% end %> - " class="square-img" target="_blank"> + <%= image_tag(url_to_avatar(shixun)) %>

- <%= shixun.name %> + <%= shixun.name %>

From 7e4bdd51abde93ae0141f8429fd9a761c92b5377 Mon Sep 17 00:00:00 2001 From: daiao <35855898@qq.com> Date: Sat, 9 Mar 2019 14:30:20 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=88=B0=E5=A4=84=E5=A2=9E=E5=8A=A0=E8=AF=BE=E7=A8=8B=E4=BD=93?= =?UTF-8?q?=E7=B3=BB=E5=92=8C=E5=AE=9E=E8=AE=AD=E7=9A=84=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 14 ++++++++++---- app/models/subject.rb | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index fe5aa922..300f8911 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -4098,7 +4098,7 @@ end book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "已发布实训课程" count_row = 2 - sheet1.row(1).concat(["", "地址", "实训课程名称","章节名称", "实训组成", "关卡数", "状态", "更新时间"]) + sheet1.row(1).concat(["", "地址", "实训课程名称","章节名称", "实训组成", "关卡数", "状态", "课程等级", "更新时间", "发布时间", ]) Rails.logger.warn("##########subjects:#{subjects.count}") subjects.each do |subject| sheet1[count_row,1] = "paths/"+subject.id.to_s @@ -4112,19 +4112,25 @@ end sheet1[count_row,5] = shixun.challenges.count sheet1[count_row,6] = shixun.shixun_status if s_index == 0 && index == 0 - sheet1[count_row,7] = format_time subject.updated_at + sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--" + sheet1[count_row,8] = format_time subject.updated_at + sheet1[count_row,9] = format_time subject.publish_time end count_row += 1 end else if s_index == 0 - sheet1[count_row,7] = format_time subject.updated_at + sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--" + sheet1[count_row,8] = format_time subject.updated_at + sheet1[count_row,9] = format_time subject.publish_time end count_row += 1 end end else - sheet1[count_row,7] = format_time subject.updated_at + sheet1[count_row,7] = subject.subject_level_system.try(:name) || "--" + sheet1[count_row,8] = format_time subject.updated_at + sheet1[count_row,9] = format_time subject.publish_time count_row += 1 end end diff --git a/app/models/subject.rb b/app/models/subject.rb index bd92c39c..59e84ee3 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -18,7 +18,7 @@ class Subject < ActiveRecord::Base has_many :tidings, :as => :container, :dependent => :destroy belongs_to :repertoire belongs_to :user - has_one :subject_level_system + belongs_to :subject_level_system scope :visible, lambda{where(status: 2)} From 14ef994d8471b915cda24214e8e4106959a7bbcc Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 9 Mar 2019 14:37:17 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 9 +++-- app/controllers/managements_controller.rb | 33 +++++++++---------- ...309061759_add_index_on_evaluate_records.rb | 8 +++++ 3 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20190309061759_add_index_on_evaluate_records.rb diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index b56e537b..0c37a3ab 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -316,9 +316,12 @@ class ChallengesController < ApplicationController script = modify_shixun_script @shixun, @shixun.evaluate_script @shixun.update_column(:evaluate_script, script) end - if path != params[:challenge][:path] - shixun_modify_status_without_publish(@shixun, 1) - end + + # 学员任务文件路径更新不需要重置 + # if path != params[:challenge][:path] + # shixun_modify_status_without_publish(@shixun, 1) + # end + Attachment.attach_files(@challenge, params[:attachments]) elsif params[:tab].to_i == 5 @challenge_tags.delete_all unless @challenge_tags.blank? diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index fe5aa922..b24d1254 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -828,31 +828,30 @@ class ManagementsController < ApplicationController @pod_num = res['sum'] @pod_dis = JSON.parse(res['distr']) if res['distr'].present? end - @search = params[:search] # 搜索字 - @keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 - if "u_name" == @keyword - if @search.blank? - @evaluate_recods = EvaluateRecord.where("0=0") - else - user_id = User.where("concat(lastname, firstname) like '%#{@search}%'") + + page = (params['page'] || 1).to_i + search = params[:search] + keyword = params[:keyword] + limit = 20 + + if search + if "u_name" == keyword @evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'") + # @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id)) + else + @evaluate_recods = EvaluateRecord.joins("join user_extensions ue on evaluate_records.user_id = ue.user_id").where("ue.school_id in (select id from schools where name like '%#{@search}%')") + # @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id)) end else - school_id = School.where("name like '%#{@search}%'").map(&:id) - user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) - @evaluate_recods = EvaluateRecord.where(:user_id => user_id) + @evaluate_recods = EvaluateRecord.all end + @evaluate_recods_count = @evaluate_recods.count - @page = (params['page'] || 1).to_i - @limit = 20 - @is_remote = true - @evaluate_recods_pages = Paginator.new @evaluate_recods_count, @limit, @page - @offset ||= @evaluate_recods_pages.offset - @evaluate_recods = paginateHelper @evaluate_recods, @limit + @evaluate_recods_pages = Paginator.new @evaluate_recods_count, limit, page + @evaluate_recods = @evaluate_recods.includes(:shixun, :user).page(page).per(limit) respond_to do |format| format.js format.html - end end diff --git a/db/migrate/20190309061759_add_index_on_evaluate_records.rb b/db/migrate/20190309061759_add_index_on_evaluate_records.rb new file mode 100644 index 00000000..126d6cfa --- /dev/null +++ b/db/migrate/20190309061759_add_index_on_evaluate_records.rb @@ -0,0 +1,8 @@ +class AddIndexOnEvaluateRecords < ActiveRecord::Migration + def up + add_index :evaluate_records, :user_id + end + + def down + end +end