@records=CompetitionTeam.find_by_sql("SELECT teams.*, cs.score AS s_score, cs.cost_time AS s_spend_time FROM competition_teams teams, competition_scores cs WHERE cs.competition_team_id = teams.`id` AND cs.competition_stage_id = '#{@stage.id}'")
@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}%'")
user=User.find_by_sql("SELECT u.* FROM `users` u, `user_extensions` ue where u.id = ue.user_id and ue.identity = 1 and ue.student_id = '#{list[0]}' and ue.school_id= #{school_id.to_i}").first
user=User.find_by_sql("SELECT u.* FROM `users` u, `user_extensions` ue where u.id = ue.user_id and ue.identity = 1 and ue.student_id = '#{list[0]}' and ue.school_id= #{school_id.to_i}").first
@ -126,21 +126,26 @@ class SchoolController < ApplicationController
chinese<<char
chinese<<char
end
end
end
end
ifpinyin.size>0
search_str="name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'"
else
search_str="name like '%#{chinese.join("")}%'"
end
ifparams[:no_school_ids]
ifparams[:no_school_ids]
if(condition=='')
if(condition=='')
@school=School.where("id not in #{params[:no_school_ids]}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school=School.where("id not in #{params[:no_school_ids]}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school_count=School.count
@school_count=School.count
else
else
@school=School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school=School.where("id not in #{params[:no_school_ids]} and #{search_str}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school_count=School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
@school_count=School.where("id not in #{params[:no_school_ids]} and #{search_str}").count
end
end
else
else
if(condition=='')
if(condition=='')
@school=School.reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school=School.reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school_count=School.count
@school_count=School.count
else
else
@school=School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school=School.where(search_str).reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i||1)).per(100)
@school_count=School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
relations=EcGraduationRequirementCalculation.joins(ec_course_support::ec_graduation_subitem_courses).where('ec_graduation_subitem_id in (?)',subitem_ids)
@ -129,7 +129,8 @@ class Myshixun < ActiveRecord::Base
ifcurrent_game.blank?
ifcurrent_game.blank?
current_game=Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
current_game=Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
# current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
# current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
href="javascript:void(0);"
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<%
<% index += 1 %>
is_start = Time.now > first_section.start_time
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;