diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 8b37ca8e4..6e6fa7d20 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -151,7 +151,7 @@ class HomeworkCommonController < ApplicationController
@homework.description = params[:homework_common][:description]
@homework.end_time = params[:homework_common][:end_time]
@homework.publish_time = params[:homework_common][:publish_time]
- @homework.homework_type = params[:homework_common][:homework_type]
+ @homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type]
unless @homework.late_penalty == params[:late_penalty]
@homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work|
student_work.late_penalty = params[:late_penalty]
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 20cdc6659..dae0bcab6 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -13,8 +13,9 @@ class StudentWorkController < ApplicationController
def index
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
- unless @group == "0" || @group.nil?
- group_students = CourseGroup.find_by_id(@group).users
+ course_group = CourseGroup.find_by_id(@group) if @group
+ if course_group
+ group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
else
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 47a3b59ae..64a478187 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2345,6 +2345,34 @@ module ApplicationHelper
#将文本内的/n转换为
def text_format text
- text.gsub("\n","
").html_safe
+ text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe
+ end
+
+ #评分规则显示
+ def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
+ if absence_penalty
+ if late_penalty.to_i == 0 && absence_penalty.to_i == 0
+ notice = "尚未设置评分规则"
+ if is_teacher
+ notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
+ end
+ elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
+ notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
+ elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
+ notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分"
+ elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
+ notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分"
+ end
+ else
+ if late_penalty.to_i == 0
+ notice = "尚未设置评分规则"
+ if is_teacher
+ notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
+ end
+ else
+ notice = "迟交扣#{late_penalty}分"
+ end
+ end
+ notice.html_safe
end
end
diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb
index a2ff6dbab..81f817ee9 100644
--- a/app/helpers/homework_common_helper.rb
+++ b/app/helpers/homework_common_helper.rb
@@ -53,31 +53,4 @@ module HomeworkCommonHelper
link
end
- #评分规则显示
- def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
- if absence_penalty
- if late_penalty.to_i == 0 && absence_penalty.to_i == 0
- notice = "尚未设置评分规则"
- if is_teacher
- notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
- end
- elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
- notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
- elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
- notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分"
- elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
- notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分"
- end
- else
- if late_penalty.to_i == 0
- notice = "尚未设置评分规则"
- if is_teacher
- notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
- end
- else
- notice = "迟交扣#{late_penalty}分"
- end
- end
- notice.html_safe
- end
end
\ No newline at end of file
diff --git a/app/views/files/searchone4reload.html.erb b/app/views/files/searchone4reload.html.erb
index 4512e52dd..75dd7bcab 100644
--- a/app/views/files/searchone4reload.html.erb
+++ b/app/views/files/searchone4reload.html.erb
@@ -2,26 +2,29 @@
<% if file.is_public? || User.current.member_of_course?(course) %>
文件大小:<%= number_to_human_size(file.filesize) %>
<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 008f88138..806768954 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -98,7 +98,7 @@