This commit is contained in:
yanxd 2014-07-05 09:40:11 +08:00
commit db28ecd883
2 changed files with 7 additions and 6 deletions

View File

@ -141,27 +141,26 @@ module WelcomeHelper
Course.active.visible.
joins(:memberships).
group('members.course_id').
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
if school_id.nil?
Course.active.visible.
joins(:memberships).
where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id).
group('members.course_id').
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
if school_id == "0"
Course.active.visible.
joins(:memberships).
group('members.course_id').
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
else
Course.active.visible.
joins(:memberships).
where("#{Course.table_name}.school_id = ?", school_id).
group('members.course_id').
reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum
reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum
end
end
end

View File

@ -73,7 +73,7 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3><strong>新开课程</strong></h3>
<% if @school_id %>
<% school_course = find_miracle_course(10, 7, @school_id) %>
<% school_course = find_miracle_course(10,7, @school_id) %>
<% else %>
<%school_course=[]%>
<% end %>
@ -138,6 +138,7 @@
</ul>
<ul class="d-p-projectlist">
<% school_course.map do |course| %>
<% if course.school%>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
@ -167,6 +168,7 @@
<% end %>
</div>
</li>
<%end%>
<% end; reset_cycle %>
<% if school_course.count < 9 %>
<li>