Merge branch 'weixin_guange' into develop

This commit is contained in:
yuanke 2016-09-23 17:47:40 +08:00
commit 60a936bcee
5 changed files with 61 additions and 1 deletions

View File

@ -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

View File

@ -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)

View File

@ -89,7 +89,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.show_name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyContent break_word" id="activity_description_<%= reply.id %>"><%= reply.content.gsub(/script/, "script&nbsp").html_safe %></div>
</div>
<script type="text/javascript">

View File

@ -37,6 +37,11 @@
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
<span class="mr15 f12 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f12 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
<div ng-if="act.homework_common_detail.homework_commit_count > 0" class="f13 c-grey2">作品提交数:<span class="c-blue">{{act.homework_common_detail.homework_commit_count}}</span></div>
<div class="f13 c-grey2">
<div ng-if="act.homework_common_detail.last_commit_info">#{{act.homework_common_detail.last_commit_info.lasttime}} <span class="c-blue ml5 mr5">{{act.homework_common_detail.last_commit_info.lastname}}</span> 提交了作品</div>
<div ng-if="act.homework_common_detail.last_score_info">#{{act.homework_common_detail.last_score_info.lasttime}} <span class="c-blue ml5 mr5">{{act.homework_common_detail.last_score_info.lastname}}</span> 评阅了作品</div>
</div>
</div>
<div class="cl"></div>
</div>
@ -402,6 +407,11 @@
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
<span class="mr15 f13 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f13 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f13 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f13 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
<div ng-if="act.homework_common_detail.homework_commit_count > 0" class="f13 c-grey2">作品提交数:<span class="c-blue">{{act.homework_common_detail.homework_commit_count}}</span></div>
<div class="f13 c-grey2">
<div ng-if="act.homework_common_detail.last_commit_info">#{{act.homework_common_detail.last_commit_info.lasttime}} <span class="c-blue ml5 mr5">{{act.homework_common_detail.last_commit_info.lastname}}</span> 提交了作品</div>
<div ng-if="act.homework_common_detail.last_score_info">#{{act.homework_common_detail.last_score_info.lasttime}} <span class="c-blue ml5 mr5">{{act.homework_common_detail.last_score_info.lastname}}</span> 评阅了作品</div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -30,6 +30,11 @@
<span ng-if="!homework.anonymous_comment" class="c-grey f12 mr15">缺评扣分:{{homework.absence_penalty}}分/作品</span>
<span ng-if="!homework.anonymous_comment" class="c-grey f12">匿评关闭时间:{{homework.evaluation_end}}</span>
<div class="cl"></div>
<div ng-if="homework.homework_commit_count > 0" class="f12 c-grey mt5 mb5">作品提交数:<span class="c-blue">{{homework.homework_commit_count}}</span></div>
<div class="f12 c-grey mb5">
<div ng-if="homework.last_commit_info">#{{homework.last_commit_info.lasttime}} <span class="c-blue ml5 mr5">{{homework.last_commit_info.lastname}}</span> 提交了作品</div>
<div ng-if="homework.last_score_info">#{{homework.last_score_info.lasttime}} <span class="c-blue ml5 mr5">{{homework.last_score_info.lastname}}</span> 评阅了作品</div>
</div>
</div>
<div class="fr f13">
<div ng-if="!homework.praise_count" ng-click="addPraise(homework);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>