1.优化路由代码
2.修改当查询学校课程数数量少于8个时,推荐9-当前学校课程数量门最好的课程给用户,并且排除当前学校课程
This commit is contained in:
parent
3fee4211a2
commit
7ead12dba6
|
@ -154,10 +154,11 @@ module WelcomeHelper
|
||||||
sort_course_by_hot limit
|
sort_course_by_hot limit
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all_new_hot_course limit = 9
|
def find_all_new_hot_course limit = 9 ,school_id
|
||||||
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||||
time_now = Time.new.strftime("%Y");
|
time_now = Time.new.strftime("%Y");
|
||||||
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all
|
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%' and #{Project.table_name}.identifier not in
|
||||||
|
(select extra from courses where school_id = #{school_id})", 1).order("course_ac_para DESC").limit(limit).all
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all_hot_bid
|
def find_all_hot_bid
|
||||||
|
|
|
@ -73,7 +73,8 @@
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||||
<h3><strong>新开课程</strong></h3>
|
<h3><strong>新开课程</strong></h3>
|
||||||
<% if(find_miracle_course(10, 7,params[:school_id]).count == 0) %>
|
<% school_course = find_miracle_course(10, 7,params[:school_id]) %>
|
||||||
|
<% if(school_course.count == 0) %>
|
||||||
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
|
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
|
@ -85,7 +86,7 @@
|
||||||
该学校未开设任何课程,您可以查看其他学校课程
|
该学校未开设任何课程,您可以查看其他学校课程
|
||||||
</p>
|
</p>
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<% find_all_new_hot_course(9).map do |project| %>
|
<% find_all_new_hot_course(9,params[:school_id]).map do |project| %>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||||
|
@ -127,13 +128,21 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
|
<% if school_course.count < 9 %>
|
||||||
|
<span>
|
||||||
|
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %>
|
||||||
|
</span>
|
||||||
|
<% else %>
|
||||||
|
<span>
|
||||||
|
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
|
<% school_course.map do |project| %>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||||
|
@ -168,6 +177,50 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end; reset_cycle %>
|
<% end; reset_cycle %>
|
||||||
|
<% if school_course.count < 9 %>
|
||||||
|
<li>
|
||||||
|
<h1></h1>
|
||||||
|
<p id="errorExplanation">
|
||||||
|
该学校开设课程较少,您可以查看其他学校课程
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<% find_all_new_hot_course(9 - school_course.count,params[:school_id]).map do |project| %>
|
||||||
|
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||||
|
<div class='avatar'>
|
||||||
|
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||||
|
</div>
|
||||||
|
<!-- 上左下右 -->
|
||||||
|
<div class='desc_item' >
|
||||||
|
<span class=''>
|
||||||
|
<% course = Course.find_by_extra(project.identifier)%>
|
||||||
|
<% if(course.school == nil) %>
|
||||||
|
|
||||||
|
<% 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 text_nowrap' style="width: 310px;">
|
||||||
|
[<%= 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>
|
||||||
|
<% if !course_endTime_timeout?(project)%>
|
||||||
|
<div >
|
||||||
|
<%= new_watcher_link(project, User.current)%>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -22,10 +22,12 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :apply_project_masters
|
resources :apply_project_masters
|
||||||
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
||||||
|
|
||||||
resources :homework_attach
|
resources :homework_attach do
|
||||||
match 'homework_attach/addjours', :controller => 'homework_attach', :action => 'addjours', :via => [:get,:post]
|
collection do
|
||||||
match 'homework_attach/add_jour_reply', :controller => 'homework_attach', :action => 'add_jour_reply', :via => [:get,:post]
|
match 'addjours', via: [:get, :post]
|
||||||
|
match 'add_jour_reply', via: [:get,:post]
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :open_source_projects do
|
resources :open_source_projects do
|
||||||
collection do
|
collection do
|
||||||
match 'search', via: [:get, :post]
|
match 'search', via: [:get, :post]
|
||||||
|
|
Loading…
Reference in New Issue