diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 3aeb37101..3c2321ae2 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,7 +1,7 @@ class HomeworkCommonController < ApplicationController layout "base_courses" before_filter :find_course, :only => [:index,:new,:create] - before_filter :find_homework, :only => [:edit,:update] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] def index @@ -135,6 +135,17 @@ class HomeworkCommonController < ApplicationController #提示 def alert_anonymous_comment + @cur_size = 0 + @totle_size = 0 + if @homework_detail_manual.comment_status == 1 + @totle_size = @course.student.count + @cur_size = @homework.student_works.size + elsif @homework_detail_manual.comment_status == 2 + @homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count} + @cur_size = 0 + @homework.student_works.map { |work| @cur_size += work.student_works_scores.count} + end + @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) respond_to do |format| format.js end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8b13f507b..d0de1690a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -201,14 +201,13 @@ module CoursesHelper end members end + def searchStudent project #searchPeopleByRoles(project, StudentRoles) members = [] - project.members.each do |m| if m && m.user && m.user.allowed_to?(:as_student,project) members << m - end end members diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 3fcd0a890..4b9a44c07 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -95,4 +95,15 @@ module HomeworkCommonHelper end type end + + #根据传入作业确定跳转到开启匿评还是关闭匿评功能 + def alert_anonyoms_path homework,homework_detail_manual + link = "" + if homework_detail_manual.comment_status == 1 + link = start_anonymous_comment_homework_common_url homework.id + elsif homework_detail_manual.comment_status == 2 + link = stop_anonymous_comment_homework_common_url homework.id + end + link + end end \ No newline at end of file diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb new file mode 100644 index 000000000..3b199e0d8 --- /dev/null +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -0,0 +1,42 @@ +
+ 开启匿评后学生将不能对作品进行 + 修改、删除 + 等操作,目前有 + <%= @totle_size%>个 + 学生,共提交了 + <%= @cur_size %> + 份作品,占 + <%= @percent %>%, + 是否确定开启匿评? +
+ <% elsif @homework_detail_manual.comment_status == 2 %> ++ 关闭匿评后学生将不能对作品进行 + 匿评 + ,且作品列表将会 + 公开, + 目前分配了 + <%= @totle_size%>份 + 匿评作品,已评了 + <%= @cur_size %> + 份作品,占 + <%= @percent %>%, + 是否确定关闭匿评? +
+ <% end %> + +