当当前学校开设课程数位0时推荐给用户的由开设课程最多的几个学校改为本系统中最好的几门课程

This commit is contained in:
sw 2014-05-12 16:01:13 +08:00
parent 75902ff118
commit f487352d6d
5 changed files with 38 additions and 15 deletions

View File

@ -108,5 +108,7 @@ module CoursesHelper
now > cTime
end
def find_by_extra_from_project extra
Course.find_by_extra(try(extra))
end
end

View File

@ -129,7 +129,7 @@ module WelcomeHelper
# end
#end
end
def find_miracle_project(sum, max_rate)
max = sum*(max_rate.to_f/10)
c1 = find_new_project(sum).to_a.dup

View File

@ -47,5 +47,4 @@ class Course < ActiveRecord::Base
return time
end
end
end

View File

@ -12,7 +12,8 @@
<span style="float: right"><%= l(:label_homework) %> (<span class=""><%= link_to (course.homeworks.count), {:controller => 'projects', :action => 'homework', :id => course.identifier} %></span>)
&nbsp;&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (course.news.count), {:controller => 'news', :action => 'index', :project_id => course.identifier} %></span>)
</td>
</span>
</td>
</tr>
<tr>
<td colspan="2" width="580" >

View File

@ -1,6 +1,7 @@
<%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html">
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
xmlns="http://www.w3.org/1999/html">
$(function(){
$("#main").find("a").attr("target", "_blank");
@ -69,25 +70,45 @@
<% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
<h1></h1>
<p id="errorExplanation">
未开设任何课程,您可以查看其他学校课程
<br/>
该学校未开设任何课程,您可以查看其他学校课程
</p>
<h1></h1>
<% find_maxmin_course_school(0,9).each do |school| %>
<li class='<%= cycle("odd", "even") %>' title=<%=school.name.to_s %>>
<% find_all_hot_course(9).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<img src="<%=school.logo_link %>" width="65" height="65">
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
</div>
<div class='text_nowrap' style="padding-left: 15px; padding-top: 8px">
[<%=school.province %>]
<%= link_to( "#{school.name}", :school_id =>"#{school.id}")%>
<!-- 上左下右 -->
<div class='desc_item text_nowrap' >
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<div class='text_nowrap' style="padding-left: 15px; padding-top: 8px">
<div class='desc_item' >
<span class=''>
<a href="/project/course?project_type=1">课程</a> 数: <%=school.courses.count %>
<% course = Course.find_by_extra(project.identifier)%>
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'>
<% if !course_endTime_timeout?(project)%>
<div >
<%= join_in_course(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end %>