This commit is contained in:
huang 2015-08-01 15:14:36 +08:00
parent 41345c329d
commit 5e857d3472
1 changed files with 13 additions and 0 deletions

View File

@ -321,6 +321,7 @@ module UsersHelper
list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
return [count,list];
end
def get_visitor_users(obj)
query = Visitor.where("master_id=?",obj.id)
count = query.count
@ -338,27 +339,34 @@ module UsersHelper
user.courses.where("is_public = 1").count
end
end
def get_join_course_count(user)
user.coursememberships.count - get_create_course_count(user)
end
def get_homework_commons_count(user)
HomeworkCommon.where("user_id = ?",user.id).count
end
def get_projectandcourse_attachment_count(user)
Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count
end
def get_create_project_count(user)
Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count
end
def get_join_project_count(user)
user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user)
end
def get_create_issue_count(user)
Issue.where("author_id = ?",user.id).count
end
def get_resolve_issue_count(user)
Issue.where("assigned_to_id = ? and status_id=3",user.id).count
end
def get_anonymous_evaluation_count(user)
StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count
end
@ -388,6 +396,7 @@ module UsersHelper
end
return str.html_safe
end
def get_activity_act_showname(activity)
case activity.act_type
when "HomeworkCommon"
@ -418,6 +427,7 @@ module UsersHelper
return activity.act_type
end
end
def get_activity_act_createtime(activity)
case activity.act_type
when "HomeworkCommon"
@ -428,6 +438,7 @@ module UsersHelper
return activity.act.created_on
end
end
def get_activity_container_url e
if !e.visible?
return "javascript:;"
@ -438,6 +449,7 @@ module UsersHelper
end
return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
end
def get_activity_url(activity,e)
if !e.visible?
return "javascript:;"
@ -466,6 +478,7 @@ module UsersHelper
return 'javascript:;'
end
end
def get_activity_opt(activity,e)
case activity.act_type
when "HomeworkCommon"