Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
0444904904
|
@ -338,41 +338,17 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
# 作业消息状态更新
|
||||
@homework.course_messages.each do |homework_message|
|
||||
if User.current.id == homework_message.user_id && homework_message.viewed == 0
|
||||
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
|
||||
|
||||
# 作业消息状态更新?
|
||||
homeworkcommon_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_message_id => @homework.id, :course_message_type => "HomeWorkCommon")
|
||||
homeworkcommon_messages.update_all(:viewed => true)
|
||||
studentwork_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_id => @homework.course, :course_message_type => "StudentWork")
|
||||
studentwork_messages.update_all(:viewed => true)
|
||||
# 作品打分消息状态更新
|
||||
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|
|
||||
studentworks_score.update_attributes(:viewed => true) if studentworks_score.viewed == 0
|
||||
end
|
||||
studentworks_scores.update_all(:viewed => true)
|
||||
# 作品评论消息状态更新
|
||||
journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0)
|
||||
journals_for_teacher.each do |journal_for_teacher|
|
||||
journal_for_teacher.update_attributes(:viewed => true)
|
||||
end
|
||||
#不能参与作业匿评消息状态更新
|
||||
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
|
||||
#设置作业对应的forge_messages表的viewed字段
|
||||
query_student_work = @homework.course_messages
|
||||
query_student_work.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
journals_for_teacher.update_all(:viewed => true)
|
||||
##################################################################################################################
|
||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
我的评分
|
||||
</th>
|
||||
</tr>
|
||||
<% @stundet_works.each_with_index do |student_work, i|%>
|
||||
<% @stundet_works.includes(:user => {:user_extensions => []}, :project => {}).each_with_index do |student_work, i|%>
|
||||
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work, :index => i}%>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
</th>
|
||||
</tr>
|
||||
<%# end %>
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<% @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).each_with_index do |student_work, i| %>
|
||||
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i} %>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddIndexToStudentWorksScores < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :student_works_scores, :user_id, name: 'user_id'
|
||||
add_index :student_works_scores, :student_work_id, name: 'student_work_id'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue