记录学生作品的提交和编辑记录

This commit is contained in:
cxt 2015-12-11 17:02:34 +08:00
parent 6c9a139450
commit e5192c7b1a
3 changed files with 7 additions and 10 deletions

View File

@ -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 {

View File

@ -1,5 +1,5 @@
class CourseMessage < ActiveRecord::Base
# status说明 status在课程不同的类型区分不同的功能
# status说明 status在课程不同的类型区分不同的功能 status = 9 作品的提交记录
# HomeworkCommonstatus
# 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

View File

@ -53,19 +53,11 @@
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li>
<%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<div id="show_student_result_div" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_id">
<%=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 %>
<!--<span title="截止日期未到,暂不能查看学生答题结果。"><%#=name%></span>-->
<%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %>
<%# end %>
</li>
<li class="hworkStID mr10 mt16" title="学号" id="student_id_id">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>