微信作业动态修改
This commit is contained in:
parent
61c2f8fdd6
commit
46c3e6e8f6
|
@ -109,6 +109,28 @@ module Mobile
|
|||
"项目"
|
||||
end
|
||||
end
|
||||
when :homework_commit_count
|
||||
if ac.act_type == "HomeworkCommon"
|
||||
ac.act.student_works.has_committed.count
|
||||
end
|
||||
when :last_commit_info
|
||||
if ac.act_type == "HomeworkCommon"
|
||||
if ac.act.student_works.has_committed.count > 0
|
||||
lc = ac.act.student_works.has_committed.reorder("commit_time desc").first
|
||||
{:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name}
|
||||
end
|
||||
end
|
||||
when :last_score_info
|
||||
if ac.act_type == "HomeworkCommon"
|
||||
if ac.act.student_works.has_committed.count > 0
|
||||
sw_id = "("+ac.act.student_works.map{|sw| sw.id}.join(",")+")"
|
||||
student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc")
|
||||
unless student_work_scores.empty?
|
||||
last_score = student_work_scores.first
|
||||
{:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -153,6 +175,10 @@ module Mobile
|
|||
act_expose :course_project_name #课程/项目名字
|
||||
act_expose :syllabus_title #课程名字
|
||||
act_expose :activity_type_name #课程问答区/项目缺陷等
|
||||
act_expose :homework_commit_count #作品提交数
|
||||
act_expose :last_commit_info #最近提交信息
|
||||
act_expose :last_score_info #最近评阅信息
|
||||
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue"
|
||||
has_praise = false
|
||||
|
|
|
@ -38,6 +38,22 @@ module Mobile
|
|||
wh.id
|
||||
when :title
|
||||
wh.name
|
||||
when :homework_commit_count
|
||||
wh.student_works.has_committed.count
|
||||
when :last_commit_info
|
||||
if wh.student_works.has_committed.count > 0
|
||||
lc = wh.student_works.has_committed.reorder("commit_time desc").first
|
||||
{:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name}
|
||||
end
|
||||
when :last_score_info
|
||||
if wh.student_works.has_committed.count > 0
|
||||
sw_id = "("+wh.student_works.map{|sw| sw.id}.join(",")+")"
|
||||
student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc")
|
||||
unless student_work_scores.empty?
|
||||
last_score = student_work_scores.first
|
||||
{:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -74,6 +90,9 @@ module Mobile
|
|||
whomework_expose :evaluation_end
|
||||
whomework_expose :praise_count
|
||||
whomework_expose :comment_count
|
||||
whomework_expose :homework_commit_count #作品提交数
|
||||
whomework_expose :last_commit_info #最近提交信息
|
||||
whomework_expose :last_score_info #最近评阅信息
|
||||
expose :all_children, using: Mobile::Entities::Jours do |f, opt|
|
||||
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
|
||||
if f.is_a?(::HomeworkCommon)
|
||||
|
|
Loading…
Reference in New Issue