diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fe7d4bbe5..b2a828768 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -308,20 +308,18 @@ class ProjectsController < ApplicationController if User.current.member_of?(@project) || User.current.admin? case params[:type] when nil - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'issue' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'news' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'message' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'attachment' - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) end else - @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public - = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") - .page(params['page'|| 1]).per(10); + @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10); end # 根据对应的请求,返回对应的数据 respond_to do |format| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d85778e73..658b44e40 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1206,9 +1206,7 @@ class UsersController < ApplicationController def show # 统计访问量 - unless User.current == @user - @user.update_attribute(:visits, @user.visits.to_i + 1) - end + @user.update_column(:visits, @user.visits.to_i + 1) unless User.current == @user #更新用户申请成为课程老师或教辅消息的状态 if params[:course_id] != nil join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?", diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 4ad3cb49d..1cd22558b 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -111,9 +111,9 @@ module IssuesHelper def principals_options_for_isuue_list(project) if User.current.member_of?(project) - project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0]) + project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0]) else - project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0]) + project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0]) end end diff --git a/app/models/user.rb b/app/models/user.rb index 78d823ea7..2a9a13c73 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -339,13 +339,15 @@ class User < Principal message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on message_new_time.save end - course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count - at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count - org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count + user = User.current + onclick_time = user.onclick_time.onclick_time + course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + system_messages_count = SystemMessage.where("created_at >?", onclick_time).count + at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count + org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count end diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index 1235b4e53..95e297f49 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -54,6 +54,10 @@ <% end %>
+ + + + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>指派 :
@@ -66,6 +70,10 @@