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