修复竞赛列表搜索结果不正确的BUG

This commit is contained in:
sw 2014-07-31 17:02:30 +08:00
parent 8b80d99a70
commit d5ac443f90
2 changed files with 5 additions and 4 deletions

View File

@ -29,8 +29,9 @@ class ContestsController < ApplicationController
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit({:limit => 10})
@contests = Contest.visible
@contests = @contests.like(params[:name]) if params[:name].present?
#@contests = Contest.visible
#@contests = @contests.like(params[:name]) if params[:name].present?
@contests = Contest.visible.where("name like '%#{params[:name]}%'")
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end

View File

@ -27,7 +27,7 @@ border:none
<em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p><%= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<!-- <p><%#= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<p><%= f.password_field :upassword, :required =>true, :label=> :field_password %>
<em class="info"><%= l(:label_upassword_info)%></em></p>
</div>