diff --git a/app/models/exercise.rb b/app/models/exercise.rb index c91e59fd9..6b437cbd8 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -8,15 +8,25 @@ class Exercise < ActiveRecord::Base has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过 # 课程消息 has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy - after_create :acts_as_course_message + after_save :acts_as_course_message def acts_as_course_message if self.course - if self.exercise_status == 2 #未发布 + if self.exercise_status == 2 && self.course_messages.where(:status => 2).blank? #已发布 + self.delay.send_exercise_message_delay #self.course.members.each do |m| - self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2) + #self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2) #end - # else - # self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的 + else + #self.course_messages.destroy_all #这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的 + end + end + end + + #测验通知delay + def send_exercise_message_delay + self.course.members.each do |m| + if m.user_id != self.user_id + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false ,:status=>2) end end end diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 3ff82243a..73ef03909 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -153,7 +153,7 @@ <%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %> -
+
<%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %> 发送 <% if exercise.exercise_status == 1 %> diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 3240cfdea..9ec6458cd 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -45,7 +45,7 @@ <% if @homework.homework_type == 1 %>

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。

<% elsif @homework.homework_type == 2 %> -

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。

+

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。

<% elsif @homework.homework_type == 3 %>

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。

<% end %> diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 18c42ba68..3279e0583 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -107,7 +107,7 @@ 现共有 -  <%= student_work.student_works_scores.where("reviewer_role = 3 and appeal_status != 3").group_by(&:user_id).count%>  +  <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>  名学生进行了匿评,平均分为  <%= format("%.1f",student_work.student_score)%> 分。
diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index 7ffb2b24f..aa752837d 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -68,11 +68,34 @@ <%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%> <% end %> <% if User.current == course.teacher || User.current.admin? %> - 归档 +
+ 归档 +
+ + +

+ 此班级的信息将不再显示
+ 您和您的学生将不能在此班级中继续互动
+ 但您可以点击“归档管理”重新恢复 +

+
+
<% end %> <% else %> <% if User.current == course.teacher || User.current.admin? %> - 恢复 +
+ 恢复 +
+ + +

+ 此班级的信息将恢复显示
+ 您和您的学生将可以重新在此班级中互动 +

+
+
<% end %> <% end %>
diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index a243e031a..32c66bba7 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -26,9 +26,9 @@
<%= course.is_delete == 0 ? '归档' : '恢复' %> -
- - +
+ +

<% if course.is_delete == 0 %> 此班级的信息将不再显示
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 1ac38638d..a3e949f43 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -368,6 +368,7 @@ 取消 <% end %> +

diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index e6fb89f8b..1b4b2929f 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -8,15 +8,13 @@ <% homework.homework_samples.each_with_index do |sample, index| %>
- - <% unless not_allow_select %> - - <% if index != 0 %> - - <% end %> + + + <% if index != 0 %> + <% end %>
- +
<% end %> @@ -40,17 +38,16 @@ 温馨提示:您可以在发布作业后,在作业"模拟答题"中进行标准代码的检测。
+
<% if edit_mode && homework.is_program_homework? %> <% homework.homework_tests.each_with_index do |test, index| %>
- - - <% unless not_allow_select %> - - <% if index != 0 %> - - <% end %> + + + + <% if index != 0 %> + <% end %>
@@ -65,6 +62,7 @@
<% end %> +
@@ -74,6 +72,10 @@ bt.LEFT_DELIMITER = ''; + <% if not_allow_select %> + $("#input_boxes_div .InputBox").on('focus', modify_input_notice); + <% end %> + $("#programHomework").on('click', 'a.test_icon_add', function () { var html = bt('t:test-answer-list', null); $(this).parent('.mt10').after(html); @@ -90,6 +92,9 @@ } } $(inputs[inputs.length - 1]).focus(); + <% if not_allow_select %> + $("#input_boxes_div .InputBox").on('focus', modify_input_notice); + <% end %> }); $("#programHomework").on('click', 'a.test_icon_remove', function () { $(this).parent('.mt10').remove(); @@ -152,4 +157,9 @@ } } <% end %> + + function modify_input_notice(){ + $("#modify_inputs_notice").html("修改测试集后请通知学生重新提交作品"); + $("#modify_inputs_notice").show(); + } \ No newline at end of file