diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index a61cc7b79..49760f734 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -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| diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index ab067fdd0..b34e1cd3c 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -1,39 +1,54 @@ 作业列表页_老师界面 - <%= stylesheet_link_tag 'css', :media => 'all' %>
- + <% if @is_teacher %> + + <% else %> + + <% end %>
<%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => false}%> -
+
diff --git a/app/views/homework_attach/get_batch_homeworks.js.erb b/app/views/homework_attach/get_batch_homeworks.js.erb index 37c95ea81..8ca588aab 100644 --- a/app/views/homework_attach/get_batch_homeworks.js.erb +++ b/app/views/homework_attach/get_batch_homeworks.js.erb @@ -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"); \ No newline at end of file diff --git a/app/views/homework_attach/get_homework_jours.js.erb b/app/views/homework_attach/get_homework_jours.js.erb index 94c564612..b77049ca6 100644 --- a/app/views/homework_attach/get_homework_jours.js.erb +++ b/app/views/homework_attach/get_homework_jours.js.erb @@ -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"); \ No newline at end of file +for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");} +$("#tb_4").removeClass().addClass("hovertab"); \ No newline at end of file diff --git a/app/views/homework_attach/get_homeworks.js.erb b/app/views/homework_attach/get_homeworks.js.erb index 8119bc5ec..73e03a289 100644 --- a/app/views/homework_attach/get_homeworks.js.erb +++ b/app/views/homework_attach/get_homeworks.js.erb @@ -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");