activity.rb

chenlw_dev
cxt 9 years ago
parent 4df5f3114d
commit 51a61a52d4

@ -30,6 +30,7 @@ module Mobile
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
end
when :subject
unless ac.act.nil?
if ac.act_type == "HomeworkCommon"
ac.act.name unless ac.nil? || ac.act.nil?
elsif ac.act_type == "News" || ac.act_type == "BlogComment"
@ -39,7 +40,9 @@ module Mobile
elsif ac.act_type == "JournalsForMessage"
ac.act.private == 0 ? "留言" : "私信"
end
end
when :description
unless ac.act.nil?
if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News"
ac.act.description unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Message" || ac.act_type == "BlogComment"
@ -47,6 +50,7 @@ module Mobile
elsif ac.act_type == "JournalsForMessage"
ac.act.notes
end
end
when :latest_update
time_from_now ac.updated_at unless ac.nil?
when :praise_count
@ -103,7 +107,8 @@ module Mobile
if a.is_a? ::UserActivity
if a.act_type == "ProjectCreateInfo"
get_user(get_project(a.act_id).user_id)
elsif a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment'
elsif !a.act.nil?
if a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment'
a.act.author
elsif a.act_type == 'HomeworkCommon' || a.act_type == 'Poll' || a.act_type == 'JournalsForMessage'
a.act.user
@ -112,6 +117,7 @@ module Mobile
end
end
end
end
expose :homework_common_detail , using: Mobile::Entities::Whomework do |a, opt| #作业相关信息
if a.act_type == "HomeworkCommon"
a.act

Loading…
Cancel
Save