根据将旧的竞赛信息和参与竞赛的项目信息迁移到新的竞赛相关数据表后重新调整竞赛子站首页最新热门竞赛的显示

exceptionHandle
wanglinchun 11 years ago
parent 9baa07b9a3
commit 9038f2758c

@ -98,14 +98,14 @@ module WelcomeHelper
end end
def find_all_hot_contest limit=10 def find_all_hot_contest limit=10
# Contest.reorder("created_on DESC").all.take limit Contest.reorder("created_on DESC").all.take limit
mix_bid = [] # mix_bid = []
mix_bid += Contest.reorder("created_on DESC").take(limit).to_a # mix_bid += Contest.reorder("created_on DESC").take(limit).to_a
mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a # mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a
mix_bid.sort do |older, newer| # mix_bid.sort do |older, newer|
newer.created_on - older.created_on # newer.created_on - older.created_on
end # end
mix_bid.take limit # mix_bid.take limit
end end
def find_all_hot_softapplication limit=10 def find_all_hot_softapplication limit=10

@ -138,7 +138,7 @@
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<div class="d-p-projectlist"> <div class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[6]) %> <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'> <li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px"> <div class="avatar-4"; style="float: left; margin-top: 7px">
@ -146,7 +146,8 @@
</div> </div>
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;"> <div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
<%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> <!-- <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> -->
<%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
</div> </div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;"> <div class='text_nowrap' style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">

Loading…
Cancel
Save