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..41e016562 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' @@ -2309,7 +2309,7 @@ module ApplicationHelper # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end else - link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评" + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评" end link end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index b1020d938..4923c629e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -582,7 +582,7 @@ module UsersHelper option << "请选择发布作业的课程" option << -1 type << option - user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] option << course.name+"("+course.time.to_s+course.term+")" option << course.id diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 07b2a345c..b820e6d54 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -71,7 +71,7 @@ class Mailer < ActionMailer::Base recipients ||= [] course.student.each do |student| user = User.find(student.student_id) - @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" @token = Token.get_token_from_user(user, 'autologin') @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @anonymous_comment_close_name = homework_common.name @@ -255,7 +255,7 @@ class Mailer < ActionMailer::Base # 作业截止时间邮件提醒 def homework_endtime__added(homework_common, user_id) user = User.find(user_id) - @subject = "#{l(:mail_homework)}#{homework_common.name}#{l(:mail_homework_endtime)} " + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} " @token = Token.get_token_from_user(user, 'autologin') @homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @homework_endtime_name = homework_common.name 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 @@ - <% if homework_common.homework_detail_manual.comment_status == 1%> + + <% if homework_common.homework_detail_manual%> + <% if homework_common.homework_detail_manual.comment_status == 1%> 未开启匿评 - <% 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%>
diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index a8401c406..f5287cbd4 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -1,94 +1,70 @@ - + function searchByChange() + { + $("#search_by_input").val($("#search_by").val()); + } + -
- <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - - - - - - - - - -
- <%= l(:label_software_user ) %> - - <%= l(:label_user_location) %> : - - - - - - - - - - -
- <%=link_to l(:field_homepage), home_path %> > - <%= l(:label_software_user)%> -
-
-<% end %> - - -
- <% if @users.size > 0 %> - <%= render :partial => 'user_show' %> - - - <% else %> - <%= render :partial => "layouts/no_content"%> - <% end %> -
- -<% html_title(l(:label_user_plural)) -%> + <% end %> + + +
+ <% if @users.size > 0 %> + <%= render :partial => 'user_show' %> + <% else %> + <%= render :partial => "layouts/no_content"%> + <% end %> +
+ +
+
+ <% html_title(l(:label_user_plural)) -%> +
+
+ + + + 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" );