From 5f1b4b1b24a53f0f78a07bd554ae96cbed2318e0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 14:16:12 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=90=8E=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E3=80=81=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=A1=86=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/homework.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index d897ba5e9..ad3ad02fe 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -115,7 +115,7 @@ $(function(){ minWidth: 753 }); - $('a.ProBtn').on('click', function(){ + $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); $(".ui-dialog-titlebar").hide(); $("a.CloseBtn").on('click', function(){ @@ -173,7 +173,7 @@ $(function(){ return valid; } - $("#BluePopupBox a.BlueCirBtn").on('click', function(){ + $("#BluePopupBox a.BlueCirBtn").live('click', function(){ if(saveProgramAnswers()){ if($( "#BluePopupBox" ).dialog( "isOpen" )){ $("#BluePopupBox").dialog( "close" ); From 709e09977068e92bab2b67adb5dfe27e0e16861d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 14:33:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=85=B3=E8=81=94=E8=A1=A8=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 6 +++--- app/helpers/api_helper.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/views/users/_user_homework_list.html.erb | 9 ++++++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 90a0f3ed6..2d7bf02b1 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -75,7 +75,7 @@ class StudentWorkController < ApplicationController @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @homework_commons = @course.homework_commons.order("created_at desc") @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 + @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 @show_all = false course_group = CourseGroup.find_by_id(@group) if @group @@ -86,7 +86,7 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -106,7 +106,7 @@ class StudentWorkController < ApplicationController @stundet_works = [] end else - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index f26f5c19b..f73cc87e6 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -75,7 +75,7 @@ module ApiHelper # 学生获取课程作业的状态 def get_homework_status homework homework_status = "" - if !homework.nil? + if homework if homework.homework_type == 1 && homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cfb655baa..f0ebf8a82 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2299,7 +2299,7 @@ module ApplicationHelper def homework_anonymous_comment homework if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" - elsif homework.student_works.count >= 2 #作业份数大于2 + elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 case homework.homework_detail_manual.comment_status when 1 link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 89800b768..f7017deab 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,12 +14,15 @@ 未开启匿评 - <% elsif homework_common.homework_detail_manual.comment_status == 2%> + <% elsif homework_common.homework_detail_manual.comment_status == 2%> 匿评中 - <% elsif homework_common.homework_detail_manual.comment_status == 3%> + <% elsif homework_common.homework_detail_manual.comment_status == 3%> 匿评已结束 + <% end%> <% end%>
- <% if homework_common.homework_detail_manual.comment_status == 1%> + + <% if homework_common.homework_detail_manual%> + <% if homework_common.homework_detail_manual.comment_status == 1%>- <%= l(:label_software_user ) %> - | -- <%= l(:label_user_location) %> : - | -- | -- - - - - - - - - | -
- <%=link_to l(:field_homepage), home_path %> > - <%= l(:label_software_user)%> - | -