parent
9b64027ed6
commit
a3c5d7eb5e
|
@ -489,37 +489,28 @@ class BidsController < ApplicationController
|
|||
|
||||
if @bid.homework_type
|
||||
@homework = HomeworkAttach.new
|
||||
if @bid.proportion
|
||||
teacher_proportion = @bid.proportion * 1.0 / 100
|
||||
else
|
||||
teacher_proportion = 1.0
|
||||
end
|
||||
#@homework_list = @bid.homeworks
|
||||
#增加作业按评分排序,
|
||||
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
|
||||
teachers = "("
|
||||
teacher_members = searchTeacherAndAssistant(@bid.courses.first)
|
||||
teacher_members.each do |member|
|
||||
if member == teacher_members.last
|
||||
teachers += member.user_id.to_s + ")"
|
||||
else
|
||||
teachers += member.user_id.to_s + ","
|
||||
@is_teacher = is_course_teacher(User.current,@bid.courses.first)
|
||||
#if @is_teacher
|
||||
teachers = "("
|
||||
teacher_members = searchTeacherAndAssistant(@bid.courses.first)
|
||||
teacher_members.each do |member|
|
||||
if member == teacher_members.last
|
||||
teachers += member.user_id.to_s + ")"
|
||||
else
|
||||
teachers += member.user_id.to_s + ","
|
||||
end
|
||||
end
|
||||
end
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
|
||||
WHERE table1.t_score IS NULL")
|
||||
#else
|
||||
# all_homework_list = HomeworkAttach.all
|
||||
#end
|
||||
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
|
||||
#limit = 10
|
||||
#feedback_count = all_homework_list.count
|
||||
#@feedback_pages = Paginator.new feedback_count, limit, params['page']
|
||||
#offset ||= @feedback_pages.offset
|
||||
#@homework_list = all_homework_list[offset, limit]
|
||||
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@homework_list.each do |pro|
|
||||
|
|
|
@ -1,39 +1,54 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>作业列表页_老师界面</title>
|
||||
<script type="text/javascript" language="javascript">
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=5;i++){$("#tb_"+i).className("normaltab");}$("#tb_"+n).className("hovertab");
|
||||
}
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content">
|
||||
<div id="tb_" class="tb_">
|
||||
<ul>
|
||||
<li id="tb_1" class="hovertab">
|
||||
<%= link_to "未批作业", get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_2" class="normaltab">
|
||||
<%= link_to "已改作业", get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_3" class="normaltab">
|
||||
<%= link_to "全部作业", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_4" class="normaltab" onclick="o:HoverLi(4);"><a href="#">作业下载</a></li>
|
||||
<li id="tb_5" class="normaltab">
|
||||
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
(<span class="c_red f_12">23</span>)
|
||||
</li>
|
||||
</ul>
|
||||
<% if @is_teacher %>
|
||||
<ul>
|
||||
<li id="tb_1" class="hovertab">
|
||||
<%= link_to "未批作品", get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_2" class="normaltab">
|
||||
<%= link_to "已改作品", get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_3" class="normaltab">
|
||||
<%= link_to "全部作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_4" class="normaltab">
|
||||
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
(<span class="c_red f_12">23</span>)
|
||||
</li>
|
||||
<li >
|
||||
<%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
|
||||
</li>
|
||||
</ul>
|
||||
<% else %>
|
||||
<ul>
|
||||
<li id="tb_1" class="hovertab">待评作品
|
||||
|
||||
</li>
|
||||
<li id="tb_2" class="normaltab">我的作品
|
||||
|
||||
</li>
|
||||
<li id="tb_3" class="normaltab">
|
||||
<%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_4" class="normaltab">
|
||||
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
(<span class="c_red f_12">23</span>)
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ctt">
|
||||
<div class="dis" id="tbc_01">
|
||||
<%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => false}%>
|
||||
</div><!---未批作业结束-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true} )) %>');
|
||||
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_2").removeClass().addClass("hovertab");
|
|
@ -1,3 +1,3 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours' )) %>');
|
||||
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_5").removeClass().addClass("hovertab");
|
||||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_4").removeClass().addClass("hovertab");
|
|
@ -1,5 +1,5 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true} )) %>');
|
||||
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_3").removeClass().addClass("hovertab");
|
||||
|
||||
|
|
Loading…
Reference in New Issue