2015-01-20 17:42:18 +08:00
|
|
|
module ApiHelper
|
|
|
|
#获取用户的工作单位
|
|
|
|
def get_user_work_unit user
|
|
|
|
work_unit = ""
|
|
|
|
if user.user_extensions.identity == 0 || user.user_extensions.identity == 1
|
|
|
|
work_unit = user.user_extensions.school.name unless user.user_extensions.school.nil?
|
|
|
|
elsif user.user_extensions.identity == 3
|
|
|
|
work_unit = user.user_extensions.occupation
|
|
|
|
elsif user.user_extensions.identity == 2
|
|
|
|
work_unit = user.firstname
|
|
|
|
end
|
|
|
|
work_unit
|
|
|
|
end
|
|
|
|
|
|
|
|
#获取用户地区
|
|
|
|
def get_user_location user
|
|
|
|
location = ""
|
|
|
|
location << (user.user_extensions.location || '')
|
|
|
|
location << (user.user_extensions.location_city || '')
|
|
|
|
location
|
|
|
|
end
|
2015-01-21 15:29:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
def get_assigned_homeworks(homeworks, n, index)
|
|
|
|
homeworks += homeworks
|
|
|
|
homeworks[index + 1 .. index + n]
|
|
|
|
end
|
2015-01-20 17:42:18 +08:00
|
|
|
end
|