老师给学生的作品打分后,学生再次编辑,要给老师和助教发消息提示
This commit is contained in:
parent
12efbcb9ae
commit
1579a86f9f
|
@ -63,6 +63,13 @@ class StudentWorkController < ApplicationController
|
|||
homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0
|
||||
end
|
||||
end
|
||||
|
||||
#修改作品提示消息更新
|
||||
student_work_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, StudentWork.name, 0)
|
||||
student_work_messages.each do |message|
|
||||
message.update_attribute(:viewed, true)
|
||||
end
|
||||
|
||||
# 作品打分消息状态更新
|
||||
studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0)
|
||||
studentworks_scores.each do |studentworks_score|
|
||||
|
@ -369,6 +376,8 @@ class StudentWorkController < ApplicationController
|
|||
@work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@work)
|
||||
if @work.save
|
||||
#如果学生作品被打分后修改,应该给老师提示
|
||||
send_message_to_teacher(@work)
|
||||
if @homework.homework_type == 3
|
||||
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
|
||||
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
|
||||
|
|
|
@ -717,6 +717,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
student_work.save
|
||||
send_message_to_teacher(student_work)
|
||||
homework.update_attributes(:updated_at => Time.now)
|
||||
update_course_activity(homework.class,homework.id)
|
||||
update_user_activity(homework.class,homework.id)
|
||||
|
|
|
@ -2137,6 +2137,20 @@ module ApplicationHelper
|
|||
|
||||
end
|
||||
|
||||
#如果学生作品被打分后修改,应该给老师提示
|
||||
def send_message_to_teacher student_work
|
||||
if StudentWork === student_work
|
||||
if student_work.student_works_scores.any?
|
||||
course = student_work.homework_common.course
|
||||
course.members.map(&:user_id).uniq.each do|user_id|
|
||||
if User.find(user_id).allowed_to?(:as_teacher, course)
|
||||
student_work.course_messages << CourseMessage.new(:user_id => user_id, :course_id => course.id, :viewed => false, :status => 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wiki_helper
|
||||
|
|
|
@ -424,6 +424,28 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if ma.course_message_type == "StudentWork" && ma.status == 1 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "同学",
|
||||
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">重新提交了作品:</span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
|
||||
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
|
||||
<%#= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<!-- 创建课程消息 -->
|
||||
<% if ma.course_message_type == "Course" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
|
|
Loading…
Reference in New Issue