absence_penalty_count=student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count-student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
@ -322,6 +323,12 @@ class ProjectsController < ApplicationController
end
defsettings
# 修改查看消息状态
applied_messages=ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?",User.current.id,@project,"AppliedProject",0)
applied_messages.eachdo|applied_message|
applied_message.update_attributes(:viewed=>true)
end
# end
@issue_custom_fields=IssueCustomField.sorted.all
@issue_category||=IssueCategory.new
@member||=@project.members.new
@ -342,7 +349,7 @@ class ProjectsController < ApplicationController
studentworks_scores=CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?",User.current.id,@homework.course,"StudentWorksScore",0)
journals_for_teacher=CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?",User.current.id,@homework.course,"JournalsForMessage",0)
@ -822,7 +865,7 @@ class UsersController < ApplicationController
when"project_message"
@user_activities=UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page*10)
when"current_user"
@user_activities=UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page*10)
@user_activities=UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page*10)
else
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page*10)