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

This commit is contained in:
wanglinchun 2014-04-25 10:10:36 +08:00
parent 9baa07b9a3
commit 9038f2758c
2 changed files with 11 additions and 10 deletions

View File

@ -98,14 +98,14 @@ module WelcomeHelper
end
def find_all_hot_contest limit=10
# Contest.reorder("created_on DESC").all.take limit
mix_bid = []
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.sort do |older, newer|
newer.created_on - older.created_on
end
mix_bid.take limit
Contest.reorder("created_on DESC").all.take limit
# mix_bid = []
# 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.sort do |older, newer|
# newer.created_on - older.created_on
# end
# mix_bid.take limit
end
def find_all_hot_softapplication limit=10

View File

@ -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>
<div class="d-p-projectlist-box">
<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") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px">
@ -146,7 +146,8 @@
</div>
<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 class='text_nowrap' style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">