From e5192c7b1a1e8f1539b47474468e9e2c5e04e970 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:02:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=A6=E7=94=9F=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E7=9A=84=E6=8F=90=E4=BA=A4=E5=92=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 +++++ app/models/course_message.rb | 4 ++-- app/views/exercise/_student_exercise.html.erb | 8 -------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 355743dd7..1fe798328 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js @@ -302,6 +305,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save =begin respond_to do |format| format.html { diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 11b0165c5..79d27f3c5 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - # status说明: status在课程不同的类型,区分不同的功能 + # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status @@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base def add_user_message #unless self.course_message_type == 'JoinCourseRequest' - if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9 self.message_alls << MessageAll.new(:user_id => self.user_id) end #end diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3983fb0c4..9c9916e60 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -53,19 +53,11 @@
  • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
  • - <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
    • <%=exercise.user.show_name %> - <%# name = exercise.user.show_name %> - <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <%# else %> - - <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <%# end %>
    • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>