将竞赛中参赛作品列表的排序方式改为按打分高低

This commit is contained in:
wanglinchun 2014-05-12 18:31:04 +08:00
parent 47b3c55b40
commit dcc4167e06
2 changed files with 13 additions and 8 deletions

View File

@ -335,7 +335,12 @@ class ContestsController < ApplicationController
end end
##取出参赛应用 ##取出参赛应用
@softapplication = Softapplication.all @softapplication = Softapplication.all
@contesting_softapplication = @contest.contesting_softapplications.reverse @contesting_softapplication = @contest.contesting_softapplications.
joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id").
joins("LEFT JOIN seems_rateable_cached_ratings ON seems_rateable_cached_ratings.cacheable_id=softapplications.id").
where("seems_rateable_cached_ratings.cacheable_type='Softapplication'").
where("seems_rateable_cached_ratings.dimension = 'quality'").
order("seems_rateable_cached_ratings.avg").reverse_order
@contesting_softapplication = paginateHelper @contesting_softapplication, 10 @contesting_softapplication = paginateHelper @contesting_softapplication, 10

View File

@ -61,13 +61,13 @@
</script> </script>
<!--参赛步骤--> <!--参赛步骤-->
<div style="padding-left: 17px; padding-bottom: 15px"> <div style="padding-left: 17px; padding-bottom: 15px; color: grey">
温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛! 温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!
</div> </div>
<% if User.current.logged? %> <% if User.current.logged? %>
<div style="padding-bottom: 10px; line-height: 25px"> <div style="padding-bottom: 10px; line-height: 25px">
<div style="padding-left: 17px; font-size: 15px"> <div style="padding-left: 45px; font-size: 15px">
<strong>参赛步骤:</strong> <strong>参赛步骤:</strong>
</div> </div>
<div style="padding-left: 82px; "> <div style="padding-left: 82px; ">
@ -90,7 +90,7 @@
<tr style="width:700px; margin-left: -10px"> <tr style="width:700px; margin-left: -10px">
<span><%= l(:label_softapplication_name) %></span> <span><%= l(:label_softapplication_name) %></span>
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -98,7 +98,7 @@
<span><%= l(:label_softapplication_version_available) %></span> <span><%= l(:label_softapplication_version_available) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -107,7 +107,7 @@
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -115,7 +115,7 @@
<span><%= l(:label_softapplication_description) %></span> <span><%= l(:label_softapplication_description) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />
@ -123,7 +123,7 @@
<span><%= l(:label_softapplication_developers) %></span> <span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td> <span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br> </tr><br/>
<br /> <br />
<br /> <br />