parent
d0c4230e69
commit
87b4c83247
|
@ -63,7 +63,7 @@ class StudentWorkController < ApplicationController
|
|||
journal_for_teacher.update_attributes(:viewed => true)
|
||||
end
|
||||
#不能参与作业匿评消息状态更新
|
||||
no_evaluation = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "NoEvaluation", 0)
|
||||
no_evaluation = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =? and status =?", User.current.id, @homework.course, "StudentWork", 0, 0)
|
||||
no_evaluation.update_all(:viewed => true)
|
||||
# 作品留言
|
||||
# 消息end
|
||||
|
@ -144,6 +144,10 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
#更新消息
|
||||
noEvaluation = @homework.course_messages.where("user_id =? and viewed =?", User.current.id, 0)
|
||||
noEvaluation.update_all(:viewed => true)
|
||||
|
||||
if @homework.homework_type==2
|
||||
redirect_to new_user_commit_homework_users_path(homework_id: @homework.id)
|
||||
return
|
||||
|
|
|
@ -128,7 +128,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#课程相关消息
|
||||
when 'homework'
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','NoEvaluation') and user_id =?", @user).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork') and user_id =?", @user).order("created_at desc")
|
||||
when 'course_message'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
when 'course_news'
|
||||
|
|
|
@ -8,6 +8,8 @@ class StudentWork < ActiveRecord::Base
|
|||
has_many :student_works_scores, :dependent => :destroy
|
||||
belongs_to :project
|
||||
has_many :student_work_tests, order: 'id desc'
|
||||
# course's message
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
|
||||
before_destroy :delete_praise
|
||||
before_save :set_program_score, :set_src
|
||||
|
@ -138,10 +140,10 @@ class StudentWork < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# status == 0 : delay
|
||||
def act_as_message
|
||||
if self.created_at > self.homework_common.end_time + 1
|
||||
CourseMessage.create(:user_id => self.user_id, :course_id => self.homework_common.course_id,
|
||||
:course_message_id => self.id, :course_message_type => 'NoEvaluation',:viewed => false)
|
||||
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && !ma.course_message.nil? %>
|
||||
<% if ma.course_message_type == "HomeworkCommon" %>
|
||||
<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" %>
|
||||
|
@ -376,27 +376,27 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<!-- 作业迟交,不能参与匿评提醒消息 -->
|
||||
<% if ma.course_message_type == "NoEvaluation" %>
|
||||
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">迟交作业,不能参与作业匿评!</span>
|
||||
</li>
|
||||
<% student_work = StudentWork.find(ma.course_message_id)%>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to "由于迟交作业,您及您的作品都不能参与作业的匿评", student_work_index_path(:homework => student_work.homework_common_id),
|
||||
<%= link_to "由于迟交作业,您及您的作品都不能参与作业的匿评", student_work_index_path(:homework => ma.course_message.homework_common_id),
|
||||
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
|
||||
:onmouseover => "message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a></li>
|
||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p>
|
||||
<%= User.current.lastname + User.current.firstname %>
|
||||
<%= User.current.allowed_to?(:as_teacher,student_work.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
|
||||
<%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
|
||||
</p>
|
||||
<p>课程名称:<%= student_work.homework_common.course.name %>(<%= student_work.homework_common.course.time.to_s + '年' + student_work.homework_common.course.term %>)</p>
|
||||
<p>作业标题:<span style="color:Red;"><%=student_work.homework_common.name %></span></p>
|
||||
<p>提交截止:<span style="color:Red;"><%=student_work.homework_common.end_time %> 24:00</span></p>
|
||||
<p>提交时间:<span style="color:Red;"><%=format_time(student_work.created_at) %></span></p>
|
||||
<p>课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)</p>
|
||||
<p>作业标题:<span style="color:Red;"><%=ma.course_message.homework_common.name %></span></p>
|
||||
<p>提交截止:<span style="color:Red;"><%=ma.course_message.homework_common.end_time %> 24:00</span></p>
|
||||
<p>提交时间:<span style="color:Red;"><%=format_time(ma.course_message.created_at) %></span></p>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue