diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 43181d8c..57ff871c 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -782,7 +782,7 @@ class CompetitionsController < ApplicationController challenges.each do |challenge| Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game| - outputs = game.outputs.select{|output| !output.text_scor.nil? } + outputs = game.outputs.select{|output| !output.text_scor.nil? && output.created_at <= e_time } if outputs.present? outputs = outputs.sort { |a, b| b[:text_scor].to_f <=> a[:text_scor].to_f } myshixun_score = outputs.first.text_scor.to_f diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 7e3b3eb0..6217532c 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1105,12 +1105,12 @@ end school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id) school_ids = school_ids.size == 0 ? "(-1)" : "(" + school_ids.join(",") + ")" location = params[:location] && params[:location] != "0" ? params[:location] : "" - @team_members = @team_members.where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'") + @team_members = @team_members.includes(user: { user_extensions: :school }).where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'") end @page = params[:page] || 1 @team_members = @team_members.reorder("team_members.created_at #{@order}") all_members = @team_members - @team_members = paginateHelper(@team_members.includes(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50) + @team_members = paginateHelper(@team_members.preload(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50) respond_to do |format| format.js format.html @@ -3425,7 +3425,7 @@ end users = users.where(schools: { province: params[:province] }) end - users = users.select('distinct users.*').order("last_login_on desc") + users = users.select('distinct users.*') @page = (params['page'] || 1).to_i @users_count = users.count @@ -3433,16 +3433,17 @@ end @is_remote = true @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 @offset ||= @users_pages.offset - @users = paginateHelper users.preload(:real_name_authentication_apply, :professional_authentication_apply, + @users = paginateHelper users.order("last_login_on desc").preload(:real_name_authentication_apply, :professional_authentication_apply, user_extensions: [:department, :school]), @limit respond_to do |format| format.js format.xls{ # @export_shixun_task = @export_shixun_task.all - @xls_users = users.reorder("created_on desc").limit(3000) #导出excel用户 + @xls_users = users.limit(3000) #导出excel用户 @xls_users = @xls_users.includes(:real_name_authentication_apply, :professional_authentication_apply, user_extensions: [:department, :school]) + filename = "用户列表.xls" send_data(user_list_xls(@xls_users), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 54cd15d6..97949807 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -159,20 +159,20 @@ class MyController < ApplicationController # 认证 - @trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first - if @trail_authentication && (@trail_authentication.status == 1 || @trail_authentication.status == 2) && !@trail_authentication.noticed - @noticed_result = true - @trail_authentication.update_attribute("noticed", 1) - elsif @user.certification != 1 && (@trail_authentication.nil? || @trail_authentication.try(:status) != 0) - first_update = Grade.where(:user_id => @user.id, :container_id => @user.id, :container_type => 'Account').first - if first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 && @user.user_day_certifications.last.present? && @user.user_day_certifications.last.status == 1 - @require_trail_auth = true - @user.user_day_certifications.update_all("status = 2") - @certification_expired = 1 - elsif first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 - @require_trail_auth = true - end - end + # @trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first + # if @trail_authentication && (@trail_authentication.status == 1 || @trail_authentication.status == 2) && !@trail_authentication.noticed + # @noticed_result = true + # @trail_authentication.update_attribute("noticed", 1) + # elsif @user.certification != 1 && (@trail_authentication.nil? || @trail_authentication.try(:status) != 0) + # first_update = Grade.where(:user_id => @user.id, :container_id => @user.id, :container_type => 'Account').first + # if first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 && @user.user_day_certifications.last.present? && @user.user_day_certifications.last.status == 1 + # @require_trail_auth = true + # @user.user_day_certifications.update_all("status = 2") + # @certification_expired = 1 + # elsif first_update.present? && (Time.now.to_i - first_update.created_at.to_i) > 86400 + # @require_trail_auth = true + # end + # end =begin if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || (ue.try(:identity) == 1 && ue.try(:student_id).blank?) || (ue.try(:identity) != 1 && ue.try(:technical_title).blank?) || ue.try(:location).nil? || ue.try(:location_city).nil? || ue.try(:gender).nil? || ue.try(:school_id).nil? diff --git a/app/views/managements/search_user.js.erb b/app/views/managements/search_user.js.erb index 6db08224..27f379fd 100644 --- a/app/views/managements/search_user.js.erb +++ b/app/views/managements/search_user.js.erb @@ -15,4 +15,7 @@ $("#user_export_list").attr("href", "<%= search_user_managements_path(:trial => :homepage_show => params[:homepage_show], :te_technical_title => params[:te_technical_title], :pro_technical_title => params[:pro_technical_title], + :province => params[:province], + :trial_whether => params[:trial_whether], + :realname => params[:realname], :format => "xls") %>"); diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 5103d7f9..6b33b461 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -3,11 +3,11 @@